
%This code calculates the equilibrium of the baseline model.
%The code first defines all variables, uploads the external data needed to
%calculate the equilibrium, and then has two main loops. The first one
%finds what is the change in the migration cost that generates a 10%
%decrease in immigrants. The second one finds prices and wages that are
%consistent with an equilibrium.
%Finally, by the end of the code, I output the tables that are present in
%the paper

clear
tic

%Notation: countries are defined by us (US), in (India), eu (Western
%Europe), ca (Canada), ch (China), ot (RoW). Industries are IT (IT and Prof
%Services), Man (High tech manufacturing), Fin (Finance), Oth (Other
%industries).

%Define the migration change in the counterfactual (e.g. mig_cf/mig_real=0.9)
target_mig=0.9;
%Initial value for migration cost change
mig_cost_change=1.05;


%Define parameters - for robustness change the parameters by hand
lambda=13.25;
epsilon=1.7;
iota=3.75;
theta=4;
kappa=6.17;

%MNE spillover, set to zero
nu=0;

%Set parameters of the model that don't change to 1

%Migration comparative advantage
A_us_IT=1;
A_us_Oth=1;
A_us_Man=1;
A_us_Fin=1;
A_in_IT=1;
A_in_Oth=1;
A_in_Man=1;
A_in_Fin=1;
A_eu_IT=1;
A_eu_Oth=1;
A_eu_Man=1;
A_eu_Fin=1;
A_ca_IT=1;
A_ca_Oth=1;
A_ca_Man=1;
A_ca_Fin=1;
A_ch_IT=1;
A_ch_Oth=1;
A_ch_Man=1;
A_ch_Fin=1;
A_ot_IT=1;
A_ot_Oth=1;
A_ot_Man=1;
A_ot_Fin=1;

%Trade costs tau_x_y_IND is cost of shipping goods from y to x in industry
%IND

tau_us_in_Oth=1;
tau_us_eu_Oth=1;
tau_us_ca_Oth=1;
tau_us_ch_Oth=1;
tau_us_ot_Oth=1;

tau_us_in_IT=1;
tau_us_eu_IT=1;
tau_us_ca_IT=1;
tau_us_ch_IT=1;
tau_us_ot_IT=1;

tau_us_in_Man=1;
tau_us_eu_Man=1;
tau_us_ca_Man=1;
tau_us_ch_Man=1;
tau_us_ot_Man=1;

tau_us_in_Fin=1;
tau_us_eu_Fin=1;
tau_us_ca_Fin=1;
tau_us_ch_Fin=1;
tau_us_ot_Fin=1;

tau_in_us_Oth=1;
tau_in_eu_Oth=1;
tau_in_ca_Oth=1;
tau_in_ch_Oth=1;
tau_in_ot_Oth=1;

tau_in_us_IT=1;
tau_in_eu_IT=1;
tau_in_ca_IT=1;
tau_in_ch_IT=1;
tau_in_ot_IT=1;

tau_in_us_Man=1;
tau_in_eu_Man=1;
tau_in_ca_Man=1;
tau_in_ch_Man=1;
tau_in_ot_Man=1;

tau_in_us_Fin=1;
tau_in_eu_Fin=1;
tau_in_ca_Fin=1;
tau_in_ch_Fin=1;
tau_in_ot_Fin=1;

tau_eu_us_Oth=1;
tau_eu_in_Oth=1;
tau_eu_ca_Oth=1;
tau_eu_ch_Oth=1;
tau_eu_ot_Oth=1;

tau_eu_us_IT=1;
tau_eu_in_IT=1;
tau_eu_ca_IT=1;
tau_eu_ch_IT=1;
tau_eu_ot_IT=1;

tau_eu_us_Fin=1;
tau_eu_in_Fin=1;
tau_eu_ca_Fin=1;
tau_eu_ch_Fin=1;
tau_eu_ot_Fin=1;

tau_eu_us_Man=1;
tau_eu_in_Man=1;
tau_eu_ca_Man=1;
tau_eu_ch_Man=1;
tau_eu_ot_Man=1;

tau_ca_us_Oth=1;
tau_ca_in_Oth=1;
tau_ca_eu_Oth=1;
tau_ca_ch_Oth=1;
tau_ca_ot_Oth=1;

tau_ca_us_IT=1;
tau_ca_in_IT=1;
tau_ca_eu_IT=1;
tau_ca_ch_IT=1;
tau_ca_ot_IT=1;

tau_ca_us_Man=1;
tau_ca_in_Man=1;
tau_ca_eu_Man=1;
tau_ca_ch_Man=1;
tau_ca_ot_Man=1;

tau_ca_us_Fin=1;
tau_ca_in_Fin=1;
tau_ca_eu_Fin=1;
tau_ca_ch_Fin=1;
tau_ca_ot_Fin=1;

tau_ch_us_Oth=1;
tau_ch_in_Oth=1;
tau_ch_eu_Oth=1;
tau_ch_ca_Oth=1;
tau_ch_ot_Oth=1;

tau_ch_us_IT=1;
tau_ch_in_IT=1;
tau_ch_eu_IT=1;
tau_ch_ca_IT=1;
tau_ch_ot_IT=1;

tau_ch_us_Man=1;
tau_ch_in_Man=1;
tau_ch_eu_Man=1;
tau_ch_ca_Man=1;
tau_ch_ot_Man=1;

tau_ch_us_Fin=1;
tau_ch_in_Fin=1;
tau_ch_eu_Fin=1;
tau_ch_ca_Fin=1;
tau_ch_ot_Fin=1;

tau_ot_us_Oth=1;
tau_ot_in_Oth=1;
tau_ot_eu_Oth=1;
tau_ot_ch_Oth=1;
tau_ot_ca_Oth=1;

tau_ot_us_IT=1;
tau_ot_in_IT=1;
tau_ot_eu_IT=1;
tau_ot_ch_IT=1;
tau_ot_ca_IT=1;

tau_ot_us_Man=1;
tau_ot_in_Man=1;
tau_ot_eu_Man=1;
tau_ot_ch_Man=1;
tau_ot_ca_Man=1;

tau_ot_us_Fin=1;
tau_ot_in_Fin=1;
tau_ot_eu_Fin=1;
tau_ot_ch_Fin=1;
tau_ot_ca_Fin=1;

%MNE costs - deltab_x_y_IND is the cost paid by MNEs from y operating in x
%in industry IND

deltab_us_in_IT=1;
deltab_us_eu_IT=1;
deltab_us_ca_IT=1;
deltab_us_ch_IT=1;

deltab_us_in_Man=1;
deltab_us_eu_Man=1;
deltab_us_ca_Man=1;
deltab_us_ch_Man=1;

deltab_us_in_Fin=1;
deltab_us_eu_Fin=1;
deltab_us_ca_Fin=1;
deltab_us_ch_Fin=1;

deltab_in_us_IT=1;
deltab_in_eu_IT=1;
deltab_in_ca_IT=1;
deltab_in_ch_IT=1;

deltab_in_us_Man=1;
deltab_in_eu_Man=1;
deltab_in_ca_Man=1;
deltab_in_ch_Man=1;

deltab_in_us_Fin=1;
deltab_in_eu_Fin=1;
deltab_in_ca_Fin=1;
deltab_in_ch_Fin=1;

deltab_eu_us_IT=1;
deltab_eu_in_IT=1;
deltab_eu_ca_IT=1;
deltab_eu_ch_IT=1;

deltab_eu_us_Man=1;
deltab_eu_in_Man=1;
deltab_eu_ca_Man=1;
deltab_eu_ch_Man=1;

deltab_eu_us_Fin=1;
deltab_eu_in_Fin=1;
deltab_eu_ca_Fin=1;
deltab_eu_ch_Fin=1;

deltab_ca_us_IT=1;
deltab_ca_in_IT=1;
deltab_ca_eu_IT=1;
deltab_ca_ch_IT=1;

deltab_ca_us_Man=1;
deltab_ca_in_Man=1;
deltab_ca_eu_Man=1;
deltab_ca_ch_Man=1;

deltab_ca_us_Fin=1;
deltab_ca_in_Fin=1;
deltab_ca_eu_Fin=1;
deltab_ca_ch_Fin=1;

deltab_ch_us_IT=1;
deltab_ch_in_IT=1;
deltab_ch_eu_IT=1;
deltab_ch_ca_IT=1;

deltab_ch_us_Man=1;
deltab_ch_in_Man=1;
deltab_ch_eu_Man=1;
deltab_ch_ca_Man=1;

deltab_ch_us_Fin=1;
deltab_ch_in_Fin=1;
deltab_ch_eu_Fin=1;
deltab_ch_ca_Fin=1;


%Technology T_x_IND of country x in industry IND
T_us_IT=1;
T_us_Oth=1;
T_us_Man=1;
T_us_Fin=1;

T_in_IT=1;
T_in_Oth=1;
T_in_Man=1;
T_in_Fin=1;

T_eu_IT=1;
T_eu_Oth=1;
T_eu_Man=1;
T_eu_Fin=1;

T_ca_IT=1;
T_ca_Oth=1;
T_ca_Man=1;
T_ca_Fin=1;

T_ch_IT=1;
T_ch_Oth=1;
T_ch_Man=1;
T_ch_Fin=1;

T_ot_IT=1;
T_ot_Oth=1;
T_ot_Man=1;
T_ot_Fin=1;

%Total high-skill labor supply by country (before migration).
N_in=1;
N_us=1;
N_eu=1;
N_ca=1;
N_ch=1;
N_ot=1;

%Total low-skill labor supply by country.
L_us=1;
L_in=1;
L_eu=1;
L_ca=1;
L_ch=1;
L_ot=1;



%High skill share parameters (domestic(d)  - source (s) - other foreign (f))
psi_d=1;
psi_s=1;
psi_f=1;

%Low- (l) and high- (h) skill share parameters in CES function
psi_l=1;
psi_h=1;
 
 
%Upload data needed for estimation

%Trade_shares_IND_x: What is the share of consumption of country x from each country. 
%Order: US (1,1) India (1,2)  Europe (1,3) Canada (1,4) China (1,5) Other
%(1,6)
%Source: WIOT

%Trade shares
Trade_shares_IT_us=[0.9719	0.0015	0.0119	0.0027	0.0017	0.0103]/sum([0.9719	0.0015	0.0119	0.0027	0.0017	0.0103]);
Trade_shares_IT_in=[0.0382	0.8340	0.0322	0.0005	0.0030	0.0921]/sum([0.0382	0.8340	0.0322	0.0005	0.0030	0.0921]);
Trade_shares_IT_eu=[0.0246	0.0021	0.9370	0.0010	0.0087	0.0266]/sum([0.0246	0.0021	0.9370	0.0010	0.0087	0.0266]);
Trade_shares_IT_ca=[0.0434	0.00003	0.0082	0.9298	0.0005	0.0181]/sum([0.0434	0.00003	0.0082	0.9298	0.0005	0.0181]);
Trade_shares_IT_ch=[0.0059	0.0004	0.0198	0.0002	0.9511	0.0225]/sum([0.0059	0.0004	0.0198	0.0002	0.9511	0.0225]);
Trade_shares_IT_ot=[0.0244	0.0182	0.0489	0.0031	0.0127	0.8927]/sum([0.0244	0.0182	0.0489	0.0031	0.0127	0.8927]);

Trade_shares_Oth_us=[0.9404	0.0010	0.0087	0.0113	0.0068	0.0319]/sum([0.9404	0.0010	0.0087	0.0113	0.0068	0.0319]);
Trade_shares_Oth_in=[0.0028	0.9079	0.0074	0.0004	0.0052	0.0763]/sum([0.0028	0.9079	0.0074	0.0004	0.0052	0.0763]);
Trade_shares_Oth_eu=[0.0074	0.0011	0.9318	0.0016	0.0053	0.0527]/sum([0.0074	0.0011	0.9318	0.0016	0.0053	0.0527]);
Trade_shares_Oth_ca=[0.0510	0.0008	0.0151	0.8864	0.0113	0.0354]/sum([0.0510	0.0008	0.0151	0.8864	0.0113	0.0354]);
Trade_shares_Oth_ch=[0.0029	0.0011	0.0047	0.0011	0.9440	0.0462]/sum([0.0029	0.0011	0.0047	0.0011	0.9440	0.0462]);
Trade_shares_Oth_ot=[0.0123	0.0032	0.0274	0.0022	0.0186	0.9363]/sum([0.0123	0.0032	0.0274	0.0022	0.0186	0.9363]);

Trade_shares_Man_us=[0.6716	0.0029	0.0729	0.0322	0.0714	0.1491]/sum([0.6716	0.0029	0.0729	0.0322	0.0714	0.1491]);
Trade_shares_Man_in=[0.0151	0.7545	0.0572	0.0034	0.0623	0.1074]/sum([0.0151	0.7545	0.0572	0.0034	0.0623	0.1074]);
Trade_shares_Man_eu=[0.0370	0.0039	0.7552	0.0033	0.0565	0.1441]/sum([0.0370	0.0039	0.7552	0.0033	0.0565	0.1441]);
Trade_shares_Man_ca=[0.4357	0.0017	0.0997	0.2416	0.0791	0.1421]/sum([0.4357	0.0017	0.0997	0.2416	0.0791	0.1421]);
Trade_shares_Man_ch=[0.0090	0.0006	0.0260	0.0005	0.8641	0.0998]/sum([0.0090	0.0006	0.0260	0.0005	0.8641	0.0998]);
Trade_shares_Man_ot=[0.0436	0.0054	0.1142	0.0029	0.0984	0.7355]/sum([0.0436	0.0054	0.1142	0.0029	0.0984	0.7355]);

Trade_shares_Fin_us=[0.9688	0.00000040	0.0157	0.0011	0.000008	0.0144]/sum([0.9688	0.00000040	0.0157	0.0011	0.000008	0.0144]);
Trade_shares_Fin_in=[0.0001	0.9915	0.0008	0.000004	0.000036	0.0074]/sum([0.0001	0.9915	0.0008	0.000004	0.000036	0.0074]);
Trade_shares_Fin_eu=[0.0152	0.0000004	0.9638	0.0006	0.0001	0.0203]/sum([0.0152	0.0000004	0.9638	0.0006	0.0001	0.0203]);
Trade_shares_Fin_ca=[0.0246	0.000003	0.0189	0.9451	0.0001	0.0113]/sum([0.0246	0.000003	0.0189	0.9451	0.0001	0.0113]);
Trade_shares_Fin_ch=[0.0003	0.000001	0.0020	0.00002	0.9867	0.0109]/sum([0.0003	0.000001	0.0020	0.00002	0.9867	0.0109]);
Trade_shares_Fin_ot=[0.0325	0.0006	0.0795	0.0024	0.0034	0.8816]/sum([0.0325	0.0006	0.0795	0.0024	0.0034	0.8816]);



%MNE_shares_IND_x: Share of production by MNEs from country y in country x
%Order: US MNEs (1,1), India MNEs (1,2), Europe MNEs (1,3) Canada MNEs (1,4) China MNEs (1,5) 

MNE_shares_IT_us=[0.954934	0.002654	0.040590	0.001789	0.000033]/sum([0.954934	0.002654	0.040590	0.001789	0.000033]);
MNE_shares_IT_in=[0.107367	0.785013	0.097028	0.004631	0.005961]/sum([0.107367	0.785013	0.097028	0.004631	0.005961]);
MNE_shares_IT_eu=[0.076562	0.002007	0.915051	0.003889	0.002491]/sum([0.076562	0.002007	0.915051	0.003889	0.002491]);
MNE_shares_IT_ca=[0.101999	0.000015	0.002563	0.892133	0.003290]/sum([0.101999	0.000015	0.002563	0.892133	0.003290]);
MNE_shares_IT_ch=[0.012075	0.000143	0.012183	0.000205	0.975394]/sum([0.012075	0.000143	0.012183	0.000205	0.975394]);

MNE_shares_Man_us=[0.7568096	0.0005910	0.2280868	0.0129315	0.0015811]/sum([0.7568096	0.0005910	0.2280868	0.0129315	0.0015811]);
MNE_shares_Man_in=[0.0428400	0.8807873	0.0714987	0.0004701	0.0044038]/sum([0.0428400	0.8807873	0.0714987	0.0004701	0.0044038]);
MNE_shares_Man_eu=[0.2027858	0.0103461	0.7624371	0.0049345	0.0194965]/sum([0.2027858	0.0103461	0.7624371	0.0049345	0.0194965]);
MNE_shares_Man_ca=[0.7208958	0.0000702	0.0050245	0.2721478	0.0018617]/sum([0.7208958	0.0000702	0.0050245	0.2721478	0.0018617]);
MNE_shares_Man_ch=[0.0206370	0.0001827	0.0192887	0.0006616	0.9592301]/sum([0.0206370	0.0001827	0.0192887	0.0006616	0.9592301]);


MNE_shares_Fin_us=[0.8481534	0.0003597	0.1257189	0.0250043	0.0007637]/sum([0.8481534	0.0003597	0.1257189	0.0250043	0.0007637]);
MNE_shares_Fin_in=[0.0470234	0.7675410	0.1710645	0.0028435	0.0115276]/sum([0.0470234	0.7675410	0.1710645	0.0028435	0.0115276]);
MNE_shares_Fin_eu=[0.1139864	0.0084779	0.8417390	0.0091764	0.0266202]/sum([0.1139864	0.0084779	0.8417390	0.0091764	0.0266202]);
MNE_shares_Fin_ca=[0.1530117	0.0000319	0.0014406	0.8455105	0.0000053]/sum([0.1530117	0.0000319	0.0014406	0.8455105	0.0000053]);
MNE_shares_Fin_ch=[0.0085458	0.0002225	0.0154861	0.0000014	0.9757442]/sum([0.0085458	0.0002225	0.0154861	0.0000014	0.9757442]);



%Production Shares - Prod_shares_IND_x - Share of production by country x sold in country y
%Order: US (1,1), India (1,2), Western Europe (1,3), Canada (1,4), China
%(1,5), Other (1,6)

Prod_shares_IT_us=[0.9462	0.0008	0.0220	0.0034	0.0019	0.0257]/sum([0.9462	0.0008	0.0220	0.0034	0.0019	0.0257]);
Prod_shares_IT_in=[0.0350	0.4498	0.0462	0.0001	0.0029	0.4661]/sum([0.0350	0.4498	0.0462	0.0001	0.0029	0.4661]);
Prod_shares_IT_eu=[0.0127	0.0008	0.9222	0.0007	0.0069	0.0567]/sum([0.0127	0.0008	0.9222	0.0007	0.0069	0.0567]);
Prod_shares_IT_ca=[0.0335	0.0001	0.0111	0.9140	0.0009	0.0404]/sum([0.0335	0.0001	0.0111	0.9140	0.0009	0.0404]);
Prod_shares_IT_ch=[0.0052	0.0002	0.0241	0.0001	0.9289	0.0414]/sum([0.0052	0.0002	0.0241	0.0001	0.9289	0.0414]);
Prod_shares_IT_ot=[0.0102	0.0021	0.0242	0.0014	0.0072	0.9550]/sum([0.0102	0.0021	0.0242	0.0014	0.0072	0.9550]);


Prod_shares_Oth_us=[0.9552	0.0004	0.0084	0.0064	0.0026	0.0262]/sum([0.9552	0.0004	0.0084	0.0064	0.0026	0.0262]);
Prod_shares_Oth_in=[0.0066	0.9313	0.0086	0.0007	0.0069	0.0459]/sum([0.0066	0.9313	0.0086	0.0007	0.0069	0.0459]);
Prod_shares_Oth_eu=[0.0079	0.0010	0.9314	0.0017	0.0038	0.0522]/sum([0.0079	0.0010	0.9314	0.0017	0.0038	0.0522]);
Prod_shares_Oth_ca=[0.0883	0.0004	0.0140	0.8523	0.0079	0.0370]/sum([0.0883	0.0004	0.0140	0.8523	0.0079	0.0370]);
Prod_shares_Oth_ch=[0.0076	0.0009	0.0065	0.0016	0.9380	0.0438]/sum([0.0076	0.0009	0.0065	0.0016	0.9380	0.0438]);
Prod_shares_Oth_ot=[0.0150	0.0054	0.0275	0.0020	0.0194	0.9305]/sum([0.0150	0.0054	0.0275	0.0020	0.0194	0.9305]);

Prod_shares_Man_us=[0.7516	0.0027	0.0435	0.0523	0.0211	0.1288]/sum([0.7516	0.0027	0.0435	0.0523	0.0211	0.1288]);
Prod_shares_Man_in=[0.0206	0.8396	0.0291	0.0013	0.0084	0.1009]/sum([0.0206	0.8396	0.0291	0.0013	0.0084	0.1009]);
Prod_shares_Man_eu=[0.0587	0.0073	0.6386	0.0086	0.0437	0.2431]/sum([0.0587	0.0073	0.6386	0.0086	0.0437	0.2431]);
Prod_shares_Man_ca=[0.4544	0.0076	0.0483	0.3662	0.0137	0.1098]/sum([0.4544	0.0076	0.0483	0.3662	0.0137	0.1098]);
Prod_shares_Man_ch=[0.0323	0.0044	0.0268	0.0038	0.8149	0.1177]/sum([0.0323	0.0044	0.0268	0.0038	0.8149	0.1177]);
Prod_shares_Man_ot=[0.0600	0.0068	0.0609	0.0061	0.0837	0.7824]/sum([0.0600	0.0068	0.0609	0.0061	0.0837	0.7824]);

Prod_shares_Fin_us=[0.9456	0.0024	0.0001	0.00001	0.0125	0.0394]/sum([0.9456	0.0024	0.0001	0.00001	0.0125	0.0394]);
Prod_shares_Fin_in=[0.00001	0.9891	0.00001	0.000004	0.00001	0.0109]/sum([0.00001	0.9891	0.00001	0.000004	0.00001	0.0109]);
Prod_shares_Fin_eu=[0.0169	0.0001	0.8743	0.0020	0.0008	0.1060]/sum([0.0169	0.0001	0.8743	0.0020	0.0008	0.1060]);
Prod_shares_Fin_ca=[0.0107	0.000002	0.0053	0.9530	0.0001	0.0309]/sum([0.0107	0.000002	0.0053	0.9530	0.0001	0.0309]);
Prod_shares_Fin_ch=[0.00002	0.00001	0.0002	0.00002	0.9883	0.0114]/sum([0.00002	0.00001	0.0002	0.00002	0.9883	0.0114]);
Prod_shares_Fin_ot=[0.0127	0.0004	0.0152	0.0010	0.0036	0.9671]/sum([0.0127	0.0004	0.0152	0.0010	0.0036	0.9671]);

%High-Skill Labor shares: skill_shares_x_y, share of high-skill wagebill
%spent on type of high-skill labor by companies in x from source country y

%Order domestic (us-us, eu-eu, ca-ca): Domestic-IT Foreign-IT Domestic-Man
%Foreign-Man Domestic-Oth Foreign-Oth Domestic-Fin Foreign-Fin

%Order Foreign MNE: Domestic-IT Source-IT Foreign-IT Domestic-Man
%Source-Man Foreign-Man Domestic-Fin Source-Fin Foreign-Fin

skill_shares_us_us=[0.896198365	0.103801635	0.850243804	0.149756196	0.90966979	0.09033021	0.944602042	0.055397958];
skill_shares_us_in=[0.065785283	0.857495683	0.076719034	0.251219022	0.659806091	0.088974887	2.24E-01	7.75E-01	7.76E-05];
skill_shares_us_eu=[0.602854915	0.015817901	0.381327183	0.83846092	0.011079194	0.150459886	6.92E-01	4.31E-02	2.65E-01];
skill_shares_us_ca=[0.889595872	0.006603388	0.10380074	0.83846092	0.041863148	0.119675933	9.02E-01	1.76E-02	8.08E-02];
skill_shares_us_ch=[0.829701836	0.041496808	0.128801356	0.022101118	0.105407506	0.872491375	6.12E-02	3.13E-01	6.26E-01];

skill_shares_eu_us=[0.908662442	0.010325597	0.081011961	0.89706554	0.00829339	0.09464107	0.93347518	0.012244447	0.054280373];
skill_shares_eu_in=[0.908662442	0.00400108	0.087336478	0.89706554	0.005892318	0.097042142	0.93347518	0.001626911	0.064897909];
skill_shares_eu_eu=[0.908662442	0.091337558	0.89706554	0.10293446	0.875192929	0.124807071	0.93347518	0.06652482];
skill_shares_eu_ca=[0.908662442	0.005237724	0.086099835	0.89706554	0.012505814	0.090428646	0.93347518	0.004602654	0.061922165];
skill_shares_eu_ch=[0.908662442	0.020728281	0.070609277	0.89706554	0.002050465	0.100883995	0.93347518	0.008636916	0.057887903];

skill_shares_ca_us=[0.642440287	0.0414497	0.316110013	0.548903938	0.04291687	0.408179192	0.587721123	0.041752522	0.370526355];
skill_shares_ca_in=[0.642440287	0.038738854	0.318820858	0.548903938	0.08149993	0.369596133	0.587721123	0.030864381	0.381414496];
skill_shares_ca_eu=[0.642440287	0.079313013	0.278246699	0.548903938	0.070609722	0.380486341	0.587721123	0.128223099	0.284055778];
skill_shares_ca_ca=[0.642440287	0.357559713	0.548903938	0.451096062	0.875192929	0.124807071	0.587721123	0.412278877];
skill_shares_ca_ch=[0.642440287	0.223143109	0.134416603	0.548903938	0.039791081	0.411304981	0.587721123	0.187975518	0.224303359];


%Low skill labor shares by country across source countries and industries.

%Order: For US, IN, EU, CA, CH: US-IT India-IT Europe-IT Canada-IT China-IT
%US-Man India-Man Europe-Man Canada-Man China-Man Other US-Fin India-Fin Europe-Fin Canada-Fin China-Fin
%For OT: IT Man Other

low_skill_share_us=[6.58E-02	1.83E-04	2.80E-03	1.23E-04	2.26E-06	4.75E-02	3.71E-05	1.43E-02	8.12E-04	9.93E-05	8.19E-01	4.20E-02	1.78E-05	6.22E-03	1.24E-03	3.78E-05]/sum([6.58E-02	1.83E-04	2.80E-03	1.23E-04	2.26E-06	4.75E-02	3.71E-05	1.43E-02	8.12E-04	9.93E-05	8.19E-01	4.20E-02	1.78E-05	6.22E-03	1.24E-03	3.78E-05]); 
low_skill_share_in=[0.000740073	0.005411053	0.000668812	3.19217E-05	4.10906E-05	0.000483251	0.009935595	0.000806531	5.30287E-06	4.96768E-05	0.978149629	0.000172908	0.002822297	0.000629015	1.04559E-05	4.23878E-05]/sum([0.000740073	0.005411053	0.000668812	3.19217E-05	4.10906E-05	0.000483251	0.009935595	0.000806531	5.30287E-06	4.96768E-05	0.978149629	0.000172908	0.002822297	0.000629015	1.04559E-05	4.23878E-05]);
low_skill_share_eu=[0.004323896	0.000113337	0.051677893	0.000219632	0.000140664	0.021871769	0.001115899	0.082233804	0.000532217	0.002102825	0.800036799	0.004061478	0.00030208	0.029992227	0.000326968	0.000948512]/sum([0.004323896	0.000113337	0.051677893	0.000219632	0.000140664	0.021871769	0.001115899	0.082233804	0.000532217	0.002102825	0.800036799	0.004061478	0.00030208	0.029992227	0.000326968	0.000948512]); 
low_skill_share_ca=[0.006637912	9.44043E-07	0.000166812	0.058058462	0.000214123	0.077976202	7.59338E-06	0.000543477	0.029437062	0.000201376	0.781943278	0.006856877	1.42931E-06	6.45572E-05	0.037889656	2.38218E-07]/sum([0.006637912	9.44043E-07	0.000166812	0.058058462	0.000214123	0.077976202	7.59338E-06	0.000543477	0.029437062	0.000201376	0.781943278	0.006856877	1.42931E-06	6.45572E-05	0.037889656	2.38218E-07]);
low_skill_share_ch=[0.000195808	2.31542E-06	0.00019757	3.32671E-06	0.015817407	0.00365296	3.23312E-05	0.003414303	0.000117111	0.169793708	0.799474388	6.23737E-05	1.62372E-06	0.00011303	1.03422E-08	0.007121734]/sum([0.000195808	2.31542E-06	0.00019757	3.32671E-06	0.015817407	0.00365296	3.23312E-05	0.003414303	0.000117111	0.169793708	0.799474388	6.23737E-05	1.62372E-06	0.00011303	1.03422E-08	0.007121734]);
low_skill_share_ot=[0.022915888	0.091957062	0.874757475	0.010369574]/sum([0.022915888	0.091957062	0.874757475	0.010369574]);



%Shares over total labor: total_shares_x_y, share of labor
%type-industry in country x by companies from y


% Order US, Europe, Canada own source: Native-IT Foreign-IT LowSkilled-IT
% Native-Man Foreign-Man LowSkilled-Man Native-Oth Foreign-Oth
% LowSkilled-Fin Native-Man Foreign-Fin LowSkilled-Fin

% Order US, Europe, Canada other source: Native-IT Source-IT Foreign-IT LowSkilled-IT Native-Man
% Source-Man Foreign-Man LowSkilled-Man Native-Fin Source-Fin Foreign-Fin LowSkilled-Fin

%Order India - China: Own source: HighSkilled-IT HighSkilled-Man
%HighSkilled-Oth LowSkilled-IT LowSkilled-Man LowSkilled-Oth
%HighSkilled-Fin LowSkilled-Fin

% Order Other: HighSkilled-IT HighSkilled-Man HighSkilled-Oth LowSkilled-IT
% LowSkilled-Man LowSkilled-Oth HighSkilled-Fin LowSkilled-Fin


%US
tot_us=sum([8.62E-02	9.99E-03	3.18E-02	2.41E-02	4.24E-03	2.30E-02	2.97E-01	2.95E-02	3.96E-01	4.19E-02	2.46E-03	2.03E-02])+sum([1.76E-05	2.29E-04	2.05E-05	8.84E-05	5.56E-06	1.46E-05	1.97E-06	1.79E-05	4.22E-06	1.46E-05	1.46E-09	8.60E-06])+...
    sum([2.47E-03	6.47E-05	1.56E-03	1.35E-03	7.16E-03	9.46E-05	1.28E-03	6.92E-03	4.55E-03	2.83E-04	1.74E-03	3.01E-03])+sum([1.60E-04	1.19E-06	1.87E-05	5.96E-05	4.06E-04	2.03E-05	5.79E-05	3.92E-04	1.18E-03	2.30E-05	1.06E-04	5.98E-04])+...
    sum([2.74E-06	1.37E-07	4.25E-07	1.09E-06	1.31E-06	6.24E-06	5.16E-05	4.80E-05	2.44E-06	1.25E-05	2.50E-05	1.83E-05]);

total_shares_us_us=[8.62E-02	9.99E-03	3.18E-02	2.41E-02	4.24E-03	2.30E-02	2.97E-01	2.95E-02	3.96E-01	4.19E-02	2.46E-03	2.03E-02]/tot_us;
total_shares_us_in=[1.76E-05	2.29E-04	2.05E-05	8.84E-05	5.56E-06	1.46E-05	1.97E-06	1.79E-05	4.22E-06	1.46E-05	1.46E-09	8.60E-06]/tot_us;
total_shares_us_eu=[2.47E-03	6.47E-05	1.56E-03	1.35E-03	7.16E-03	9.46E-05	1.28E-03	6.92E-03	4.55E-03	2.83E-04	1.74E-03	3.01E-03]/tot_us;
total_shares_us_ca=[1.60E-04	1.19E-06	1.87E-05	5.96E-05	4.06E-04	2.03E-05	5.79E-05	3.92E-04	1.18E-03	2.30E-05	1.06E-04	5.98E-04]/tot_us;
total_shares_us_ch=[2.74E-06	1.37E-07	4.25E-07	1.09E-06	1.31E-06	6.24E-06	5.16E-05	4.80E-05	2.44E-06	1.25E-05	2.50E-05	1.83E-05]/tot_us;


%India

tot_in=sum([0.012332141	0.007212015	0.227158481	0.003987341	0.007321422	0.720786827	0.00925331	0.002079717])+sum([0.001686674	0.00035078	0.000545351	0.000356102	0.000566903	0.000127414])+...
    sum([0.001524266	0.000585442	0.00049284	0.000594323	0.002062317	0.000463514])+sum([7.27516E-05	3.84923E-06	2.35227E-05	3.90762E-06	3.42811E-05	7.7048E-06])+...
    sum([9.36481E-05	3.60593E-05	3.02792E-05	3.66063E-05	0.000138975	3.12351E-05]);

total_shares_in_in=[0.012332141	0.007212015	0.227158481	0.003987341	0.007321422	0.720786827	0.00925331	0.002079717]/tot_in;
total_shares_in_us=[0.001686674	0.00035078	0.000545351	0.000356102	0.000566903	0.000127414]/tot_in;
total_shares_in_eu=[0.001524266	0.000585442	0.00049284	0.000594323	0.002062317	0.000463514]/tot_in;
total_shares_in_ca=[7.27516E-05	3.84923E-06	2.35227E-05	3.90762E-06	3.42811E-05	7.7048E-06]/tot_in;
total_shares_in_ch=[9.36481E-05	3.60593E-05	3.02792E-05	3.66063E-05	0.000138975	3.12351E-05]/tot_in;

%Europe

tot_eu=sum([0.039973798	0.004018114	0.031235996	0.032881808	0.003773048	0.049705099	0.230349003	0.032848968	0.483571314	0.028454776	0.002027851	0.018128392])+sum([8.76684E-05	3.86027E-07	8.42629E-06	6.85052E-05	0.000446201	2.93084E-06	4.82688E-05	0.00067449	0.000286594	4.99492E-07	1.99249E-05	0.000182588])+...
    sum([0.003344613	2.99029E-05	0.000306293	0.00261352	0.008745592	8.08532E-05	0.000922666	0.013220092	0.00385328	5.05437E-05	0.000224063	0.002454905])+sum([0.000169889	9.79278E-07	1.60978E-05	0.000132754	0.000212811	2.96675E-06	2.14524E-05	0.000321691	0.000310208	1.52953E-06	2.05776E-05	0.000197632])+...
    sum([0.000108806	2.48206E-06	8.45495E-06	8.50221E-05	0.000840831	1.92193E-06	9.45598E-05	0.001271024	0.00089989	8.32617E-06	5.58052E-05	0.000573315]);

total_shares_eu_eu=[0.039973798	0.004018114	0.031235996	0.032881808	0.003773048	0.049705099	0.230349003	0.032848968	0.483571314	0.028454776	0.002027851	0.018128392]/tot_eu;
total_shares_eu_in=[8.76684E-05	3.86027E-07	8.42629E-06	6.85052E-05	0.000446201	2.93084E-06	4.82688E-05	0.00067449	0.000286594	4.99492E-07	1.99249E-05	0.000182588]/tot_eu;
total_shares_eu_us=[0.003344613	2.99029E-05	0.000306293	0.00261352	0.008745592	8.08532E-05	0.000922666	0.013220092	0.00385328	5.05437E-05	0.000224063	0.002454905]/tot_eu;
total_shares_eu_ca=[0.000169889	9.79278E-07	1.60978E-05	0.000132754	0.000212811	2.96675E-06	2.14524E-05	0.000321691	0.000310208	1.52953E-06	2.05776E-05	0.000197632]/tot_eu;
total_shares_eu_ch=[0.000108806	2.48206E-06	8.45495E-06	8.50221E-05	0.000840831	1.92193E-06	9.45598E-05	0.001271024	0.00089989	8.32617E-06	5.58052E-05	0.000573315]/tot_eu;


%Canada


tot_ca=sum([0.039436734	0.021949102	0.033205667	0.003662321	0.003009741	0.016836086	0.219397743	0.100220348	0.447220727	0.007514817	0.005271548	0.02167042])+sum([6.4125E-07	3.86671E-08	3.1823E-07	5.39931E-07	9.44707E-07	1.40268E-07	6.36104E-07	4.34292E-06	2.83481E-07	1.48871E-08	1.83971E-07	8.17472E-07])+...
    sum([0.000113308	1.39886E-05	4.90749E-05	9.54054E-05	6.7615E-05	8.69784E-06	4.6869E-05	0.000310833	1.28039E-05	2.79343E-06	6.18835E-06	3.69225E-05])+sum([0.004508862	0.000290908	0.002218566	0.003796454	0.009701168	0.0007585	0.00721404	0.044597319	0.001359954	9.6613E-05	0.000857377	0.003921688])+...
    sum([0.000145445	5.05184E-05	3.04312E-05	0.000122465	2.50536E-05	1.81618E-06	1.87732E-05	0.000115174	4.72469E-08	1.51113E-08	1.80317E-08	1.36245E-07]);

total_shares_ca_ca=[0.039436734	0.021949102	0.033205667	0.003662321	0.003009741	0.016836086	0.219397743	0.100220348	0.447220727	0.007514817	0.005271548	0.02167042]/tot_ca;
total_shares_ca_in=[6.4125E-07	3.86671E-08	3.1823E-07	5.39931E-07	9.44707E-07	1.40268E-07	6.36104E-07	4.34292E-06	2.83481E-07	1.48871E-08	1.83971E-07	8.17472E-07]/tot_ca;
total_shares_ca_eu=[0.000113308	1.39886E-05	4.90749E-05	9.54054E-05	6.7615E-05	8.69784E-06	4.6869E-05	0.000310833	1.28039E-05	2.79343E-06	6.18835E-06	3.69225E-05]/tot_ca;
total_shares_ca_us=[0.004508862	0.000290908	0.002218566	0.003796454	0.009701168	0.0007585	0.00721404	0.044597319	0.001359954	9.6613E-05	0.000857377	0.003921688]/tot_ca;
total_shares_ca_ch=[0.000145445	5.05184E-05	3.04312E-05	0.000122465	2.50536E-05	1.81618E-06	1.87732E-05	0.000115174	4.72469E-08	1.51113E-08	1.80317E-08	1.36245E-07]/tot_ca;


%China

tot_ch=sum([0.032420161	0.110842798	0.166974979	0.010482383	0.1125243	0.529821138	0.020999232	0.004719658])+sum([0.000401338	0.002384684	0.000129764	0.00242086	0.000183916	4.13358E-05])+...
    sum([0.000404949	0.002228887	0.000130932	0.002262699	0.000333281	7.49061E-05])+sum([6.8186E-06	7.64509E-05	2.20465E-06	7.76106E-05	3.04951E-08	6.85389E-09])+...
    sum([4.74581E-06	2.11061E-05	1.53446E-06	2.14263E-05	4.78773E-06	1.07606E-06]);

total_shares_ch_ch=[0.032420161	0.110842798	0.166974979	0.010482383	0.1125243	0.529821138	0.020999232	0.004719658]/tot_ch;
total_shares_ch_us=[0.000401338	0.002384684	0.000129764	0.00242086	0.000183916	4.13358E-05]/tot_ch;
total_shares_ch_eu=[0.000404949	0.002228887	0.000130932	0.002262699	0.000333281	7.49061E-05]/tot_ch;
total_shares_ch_ca=[6.8186E-06	7.64509E-05	2.20465E-06	7.76106E-05	3.04951E-08	6.85389E-09]/tot_ch;
total_shares_ch_in=[4.74581E-06	2.11061E-05	1.53446E-06	2.14263E-05	4.78773E-06	1.07606E-06]/tot_ch;


%Other
total_shares_ot=[0.047782545	0.061069404	0.185860545	0.015449489	0.061995836	0.589746119	0.031105077	0.006990985]/sum([0.047782545	0.061069404	0.185860545	0.015449489	0.061995836	0.589746119	0.031105077	0.006990985]);


%Migration Shares (eg US-IT-us: migration to US, industry IT, source US) 

% mig_us=[US-IT-us US-IT-in US-IT-eu US-IT-ca US-IT-ch US-Man-us US-Man-in US-Man-eu US-Man-ca US-Man-ch US-Oth-us...
%     EU-IT-us EU-IT-in EU-IT-eu EU-IT-ca EU-IT-ch EU-Man-us EU-Man-in EU-Man-eu EU-Man-ca EU-Man-ch EU-Oth-us...
%     CA-IT-us CA-IT-in CA-IT-eu CA-IT-ca CA-IT-ch CA-Man-us CA-Man-in CA-Man-eu CA-Man-ca CA-Man-ch CA-Oth-us...
%     US-Fin-us US-Fin-in US-Fin-eu US-Fin-ca US-Fin-ch EU-Fin-us EU-Fin-in EU-Fin-eu EU-Fin-ca EU-Fin-ch CA-Fin-us CA-Fin-in CA-Fin-eu CA-Fin-ca CA-Fin-ch];

mig_us=[0.155850927	5.43519E-05	0.004578039	0.000289996	4.97544E-06	0.083314639	4.70298E-05	0.024972406	0.001415822	0.000107358	0.646061757...				
0.000127469	2.64887E-06	0.001215277	4.9936E-06	2.66977E-06	7.47004E-05	2.69154E-06	0.000202083	1.18274E-06	5.19591E-06	0.005348749...				
7.96017E-05	4.85552E-09	8.24517E-07	0.00030352	4.76007E-07	0.000212184	4.54349E-09	3.30246E-07	1.88186E-05	1.32172E-07	0.001302408...				
0.064748776	8.14362E-06	0.0072297	0.00182869	7.99287E-06	0.000125308	3.6565E-06	0.000358044	3.71138E-06	1.02199E-05	2.70133E-05	1.79282E-09	6.06069E-08	4.54151E-05	1.77748E-10]/sum([0.155850927	5.43519E-05	0.004578039	0.000289996	4.97544E-06	0.083314639	4.70298E-05	0.024972406	0.001415822	0.000107358	0.646061757...				
0.000127469	2.64887E-06	0.001215277	4.9936E-06	2.66977E-06	7.47004E-05	2.69154E-06	0.000202083	1.18274E-06	5.19591E-06	0.005348749...				
7.96017E-05	4.85552E-09	8.24517E-07	0.00030352	4.76007E-07	0.000212184	4.54349E-09	3.30246E-07	1.88186E-05	1.32172E-07	0.001302408...				
0.064748776	8.14362E-06	0.0072297	0.00182869	7.99287E-06	0.000125308	3.6565E-06	0.000358044	3.71138E-06	1.02199E-05	2.70133E-05	1.79282E-09	6.06069E-08	4.54151E-05	1.77748E-10]);


% mig_in=[US-IT-us US-IT-in US-IT-eu US-IT-ca US-IT-ch US-Man-us US-Man-in US-Man-eu US-Man-ca US-Man-ch US-Oth-us...
%     EU-IT-us EU-IT-in EU-IT-eu EU-IT-ca EU-IT-ch EU-Man-us EU-Man-in EU-Man-eu EU-Man-ca EU-Man-ch EU-Oth-us...
%     CA-IT-us CA-IT-in CA-IT-eu CA-IT-ca CA-IT-ch CA-Man-us CA-Man-in CA-Man-eu CA-Man-ca CA-Man-ch CA-Oth-us...
%     IN-IT-us IN-IT-in IN-IT-eu IN-IT-ca IN-IT-ch IN-Man-us IN-Man-in IN-Man-eu IN-Man-ca IN-Man-ch IN-Oth-us...
%     US-Fin-us US-Fin-in US-Fin-eu US-Fin-ca US-Fin-ch EU-Fin-us EU-Fin-in EU-Fin-eu EU-Fin-ca EU-Fin-ch...
%     CA-Fin-us CA-Fin-in CA-Fin-eu CA-Fin-ca CA-Fin-ch IN-Fin-us IN-Fin-in IN-Fin-eu IN-Fin-ca IN-Fin-ch];

mig_in=[0.015257803	0.000441302	0.002516658	2.86121E-05	5.93121E-07	0.004021236	2.27651E-05	0.001211233	2.86121E-05	5.93121E-07	0.045613256...
5.93332E-05	1.8339E-06	0.000723138	2.97139E-06	1.58862E-06	3.98188E-05	3.01776E-06	0.000153391	8.97758E-07	3.94394E-06	0.006845084...
6.67634E-05	1.17916E-08	1.70362E-06	0.000627135	9.8353E-07	0.00028668	4.37303E-08	2.05202E-06	0.000116931	8.21261E-07	0.003031715...
0.020888575	0.152727083	0.018877237	0.00090099	0.001159783	0.004344232	0.08931701	0.007250392	4.76707E-05	0.000446575	0.469210371...
0.002351798	9.01427E-06	0.001493052	7.80926E-05	1.12257E-05	2.52475E-05	1.38009E-06	0.000212226	2.19987E-06	6.05772E-06...	
3.19626E-05	4.63894E-09	2.54177E-07	0.000190465	7.45453E-10	0.007020802	0.114597382	0.025540714	0.000424553	0.001721128]/sum([0.015257803	0.000441302	0.002516658	2.86121E-05	5.93121E-07	0.004021236	2.27651E-05	0.001211233	2.86121E-05	5.93121E-07	0.045613256...
5.93332E-05	1.8339E-06	0.000723138	2.97139E-06	1.58862E-06	3.98188E-05	3.01776E-06	0.000153391	8.97758E-07	3.94394E-06	0.006845084...
6.67634E-05	1.17916E-08	1.70362E-06	0.000627135	9.8353E-07	0.00028668	4.37303E-08	2.05202E-06	0.000116931	8.21261E-07	0.003031715...
0.020888575	0.152727083	0.018877237	0.00090099	0.001159783	0.004344232	0.08931701	0.007250392	4.76707E-05	0.000446575	0.469210371...
0.002351798	9.01427E-06	0.001493052	7.80926E-05	1.12257E-05	2.52475E-05	1.38009E-06	0.000212226	2.19987E-06	6.05772E-06...	
3.19626E-05	4.63894E-09	2.54177E-07	0.000190465	7.45453E-10	0.007020802	0.114597382	0.025540714	0.000424553	0.001721128]);


% 
% mig_eu=[US-IT-us US-IT-in US-IT-eu US-IT-ca US-IT-ch US-Man-us US-Man-in US-Man-eu US-Man-ca US-Man-ch US-Oth-us...
%     EU-IT-us EU-IT-in EU-IT-eu EU-IT-ca EU-IT-ch EU-Man-us EU-Man-in EU-Man-eu EU-Man-ca EU-Man-ch EU-Oth-us...
%     CA-IT-us CA-IT-in CA-IT-eu CA-IT-ca CA-IT-ch CA-Man-us CA-Man-in CA-Man-eu CA-Man-ca CA-Man-ch CA-Oth-us...
%     US-Fin-us US-Fin-in US-Fin-eu US-Fin-ca US-Fin-ch EU-Fin-us EU-Fin-in EU-Fin-eu EU-Fin-ca EU-Fin-ch CA-Fin-us CA-Fin-in CA-Fin-eu CA-Fin-ca CA-Fin-ch];

mig_eu=[0.000340336	5.35887E-06	6.93837E-05	1.0284E-06	1.83279E-08	0.000204106	2.87861E-07	9.22191E-05	1.0082E-05	4.10297E-07	0.003653257...				
0.012371454	0.000324279	0.14785987	0.000628407	0.000402464	0.007756924	0.000395759	0.029164599	0.000188753	0.000745777	0.722232284...				
9.53404E-05	1.43268E-08	3.22568E-06	0.00089557	1.40451E-06	0.000195916	1.92932E-08	2.05045E-06	7.99106E-05	5.61247E-07	0.003290472...				
0.000138517	5.84345E-06	0.000295005	1.09476E-05	3.26479E-06	0.007792069	0.000579549	0.057540992	0.000627299	0.001819749	2.50838E-05	5.90068E-09	6.58202E-07	0.000149474	5.85021E-10]/sum([0.000340336	5.35887E-06	6.93837E-05	1.0284E-06	1.83279E-08	0.000204106	2.87861E-07	9.22191E-05	1.0082E-05	4.10297E-07	0.003653257...				
0.012371454	0.000324279	0.14785987	0.000628407	0.000402464	0.007756924	0.000395759	0.029164599	0.000188753	0.000745777	0.722232284...				
9.53404E-05	1.43268E-08	3.22568E-06	0.00089557	1.40451E-06	0.000195916	1.92932E-08	2.05045E-06	7.99106E-05	5.61247E-07	0.003290472...				
0.000138517	5.84345E-06	0.000295005	1.09476E-05	3.26479E-06	0.007792069	0.000579549	0.057540992	0.000627299	0.001819749	2.50838E-05	5.90068E-09	6.58202E-07	0.000149474	5.85021E-10]);

% mig_ca=[US-IT-us US-IT-in US-IT-eu US-IT-ca US-IT-ch US-Man-us US-Man-in US-Man-eu US-Man-ca US-Man-ch US-Oth-us...
%     EU-IT-us EU-IT-in EU-IT-eu EU-IT-ca EU-IT-ch EU-Man-us EU-Man-in EU-Man-eu EU-Man-ca EU-Man-ch EU-Oth-us...
%     CA-IT-us CA-IT-in CA-IT-eu CA-IT-ca CA-IT-ch CA-Man-us CA-Man-in CA-Man-eu CA-Man-ca CA-Man-ch CA-Oth-us
%     US-Fin-us US-Fin-in US-Fin-eu US-Fin-ca US-Fin-ch EU-Fin-us EU-Fin-in EU-Fin-eu EU-Fin-ca EU-Fin-ch CA-Fin-us CA-Fin-in CA-Fin-eu CA-Fin-ca CA-Fin-ch];


mig_ca=[0.002385767	4.86971E-05	0.000391687	1.09067E-05	4.0325E-08	0.001796185	3.87611E-06	0.000770198	1.09067E-05	6.82066E-06	0.028437922...				
0.00022148	5.88362E-06	0.002699347	2.6316E-05	5.93003E-06	0.000162825	8.35414E-06	0.000627238	1.72794E-05	1.61274E-05	0.008435545...				
0.007777765	1.10615E-06	0.000195456	0.068028179	0.000250892	0.017108133	1.666E-06	0.00011924	0.00645855	4.41823E-05	0.835419221...				
0.001009409	3.64274E-06	0.000850586	0.000173717	6.51274E-06	7.93678E-05	6.81323E-06	0.00066715	2.39051E-05	1.9043E-05	0.002397102	4.99674E-07	2.25686E-05	0.013245878	8.3279E-08]/sum([0.002385767	4.86971E-05	0.000391687	1.09067E-05	4.0325E-08	0.001796185	3.87611E-06	0.000770198	1.09067E-05	6.82066E-06	0.028437922...				
0.00022148	5.88362E-06	0.002699347	2.6316E-05	5.93003E-06	0.000162825	8.35414E-06	0.000627238	1.72794E-05	1.61274E-05	0.008435545...				
0.007777765	1.10615E-06	0.000195456	0.068028179	0.000250892	0.017108133	1.666E-06	0.00011924	0.00645855	4.41823E-05	0.835419221...				
0.001009409	3.64274E-06	0.000850586	0.000173717	6.51274E-06	7.93678E-05	6.81323E-06	0.00066715	2.39051E-05	1.9043E-05	0.002397102	4.99674E-07	2.25686E-05	0.013245878	8.3279E-08]);



mig_ch=[0.001236101	5.79629E-06	0.0001386	2.49331E-06	3.74686E-07	0.001021529	3.55708E-07	0.000258561	1.18846E-05	1.0985E-05	0.009497173...
7.71349E-05	2.04909E-06	0.0009401	3.86289E-06	1.37723E-05	2.97673E-05	1.52729E-06	0.00011467	6.71136E-07	2.31134E-06	0.005140312...
9.65032E-05	1.45015E-08	2.46251E-06	0.000906493	1.79936E-05	0.000300685	2.96105E-08	2.15226E-06	0.000122644	6.6133E-07	0.002804732...
0.000501674	5.93227E-06	0.000506187	8.52327E-06	0.040525276	0.004539265	4.01756E-05	0.004242703	0.000145525	0.210990129	0.692553223...
0.000700344	7.52157E-07	0.000496466	4.66301E-05	3.86618E-05	2.79398E-05	2.39846E-06	0.000234857	2.43446E-06	2.68695E-05...	
4.05784E-05	9.54561E-09	3.22693E-07	0.000241807	5.49979E-09	0.00018217	4.74227E-06	0.000330116	3.02055E-08	0.020799849]/sum([0.001236101	5.79629E-06	0.0001386	2.49331E-06	3.74686E-07	0.001021529	3.55708E-07	0.000258561	1.18846E-05	1.0985E-05	0.009497173...
7.71349E-05	2.04909E-06	0.0009401	3.86289E-06	1.37723E-05	2.97673E-05	1.52729E-06	0.00011467	6.71136E-07	2.31134E-06	0.005140312...
9.65032E-05	1.45015E-08	2.46251E-06	0.000906493	1.79936E-05	0.000300685	2.96105E-08	2.15226E-06	0.000122644	6.6133E-07	0.002804732...
0.000501674	5.93227E-06	0.000506187	8.52327E-06	0.040525276	0.004539265	4.01756E-05	0.004242703	0.000145525	0.210990129	0.692553223...
0.000700344	7.52157E-07	0.000496466	4.66301E-05	3.86618E-05	2.79398E-05	2.39846E-06	0.000234857	2.43446E-06	2.68695E-05...	
4.05784E-05	9.54561E-09	3.22693E-07	0.000241807	5.49979E-09	0.00018217	4.74227E-06	0.000330116	3.02055E-08	0.020799849	]);

% mig_ot=[US-IT-us US-IT-in US-IT-eu US-IT-ca US-IT-ch US-Man-us US-Man-in US-Man-eu US-Man-ca US-Man-ch US-Oth-us...
%     EU-IT-us EU-IT-in EU-IT-eu EU-IT-ca EU-IT-ch EU-Man-us EU-Man-in EU-Man-eu EU-Man-ca EU-Man-ch EU-Oth-us...
%     CA-IT-us CA-IT-in CA-IT-eu CA-IT-ca CA-IT-ch CA-Man-us CA-Man-in CA-Man-eu CA-Man-ca CA-Man-ch CA-Oth-us...
%     OT-IT-ot OT-Man-ot OT-Oth-ot...
%     US-Fin-us US-Fin-in US-Fin-eu US-Fin-ca US-Fin-ch EU-Fin-us EU-Fin-in EU-Fin-eu EU-Fin-ca EU-Fin-ch...
%     CA-Fin-us CA-Fin-in CA-Fin-eu CA-Fin-ca CA-Fin-ch OT-Fin-ot];

mig_ot=[0.000483454	3.47972E-06	7.83197E-05	1.0225E-06	3.33367E-08	0.000255626	2.66009E-07	0.000107788	8.20395E-06	1.1018E-06	0.004990327...					
0.000346848	9.21401E-06	0.004227294	1.737E-05	9.28669E-06	0.000230036	1.18026E-05	0.000886152	5.18642E-06	2.27845E-05	0.027156103...					
0.000107793	1.61981E-08	2.7506E-06	0.001012546	1.58797E-06	0.000388578	3.8266E-08	2.78139E-06	0.000158494	1.11317E-06	0.004899538...					
0.055729448	0.108463343	0.754646221...													
0.000158968	1.38458E-06	0.000203973	1.10834E-05	2.63016E-06	0.000149396	1.28247E-05	0.001255791	1.30172E-05	3.5845E-05	4.49591E-05	1.05761E-08	3.5753E-07	0.000267912	1.04857E-09	0.0335759]/sum([0.000483454	3.47972E-06	7.83197E-05	1.0225E-06	3.33367E-08	0.000255626	2.66009E-07	0.000107788	8.20395E-06	1.1018E-06	0.004990327...					
0.000346848	9.21401E-06	0.004227294	1.737E-05	9.28669E-06	0.000230036	1.18026E-05	0.000886152	5.18642E-06	2.27845E-05	0.027156103...					
0.000107793	1.61981E-08	2.7506E-06	0.001012546	1.58797E-06	0.000388578	3.8266E-08	2.78139E-06	0.000158494	1.11317E-06	0.004899538...					
0.055729448	0.108463343	0.754646221...													
0.000158968	1.38458E-06	0.000203973	1.10834E-05	2.63016E-06	0.000149396	1.28247E-05	0.001255791	1.30172E-05	3.5845E-05	4.49591E-05	1.05761E-08	3.5753E-07	0.000267912	1.04857E-09	0.0335759]);

%Foreign non-source share - share among non source immigrants by industry
%and source

%Foreign_IT_us_us=[India Europe Canada China Other];
Foreign_IT_us_us=[7.69E-01	3.28E-02	3.19E-02	6.20E-02	1.04E-01]/sum([7.69E-01	3.28E-02	3.19E-02	6.20E-02	1.04E-01]);
%Foreign_IT_us_in=[Europe Canada China Other];
Foreign_IT_us_in=[2.33E-01	0.301364259	0.119858834	0.345971215]/sum([2.33E-01	0.301364259	0.119858834	0.345971215]);
%Foreign_IT_us_eu=[India Canada China Other];
Foreign_IT_us_eu=[8.22E-01	3.34E-02	4.10E-02	1.03E-01]/sum([8.22E-01	3.34E-02	4.10E-02	1.03E-01]);
%Foreign_IT_us_ca=[India Europe China Other];
Foreign_IT_us_ca=[0.776490304	0.056800807	0.060835961	0.105872928]/sum([0.776490304	0.056800807	0.060835961	0.105872928]);
%Foreign_IT_us_ch=[India Europe Canada Other];
Foreign_IT_us_ch=[7.94E-01	3.69E-02	9.04E-03	1.61E-01]/sum([7.94E-01	3.69E-02	9.04E-03	1.61E-01]);
%Foreign_Man_us_us=[India Europe Canada China Other];
Foreign_Man_us_us=[6.13E-01	5.13E-02	5.55E-02	1.33E-01	1.48E-01]/sum([6.13E-01	5.13E-02	5.55E-02	1.33E-01	1.48E-01]);
%Foreign_Man_us_in=[Europe Canada China Other];
Foreign_Man_us_in=[0.15846123	0.285230215	0.092383176	0.463925379]/sum([0.15846123	0.285230215	0.092383176	0.463925379]);
%Foreign_Man_us_eu=[India Canada China Other];
Foreign_Man_us_eu=[6.13E-01	8.16E-02	1.07E-01	1.98E-01]/sum([6.13E-01	8.16E-02	1.07E-01	1.98E-01]);
%Foreign_Man_us_ca=[India Europe China Other];
Foreign_Man_us_ca=[0.450295614	0.115933655	0.109376745	0.324393985]/sum([0.450295614	0.115933655	0.109376745	0.324393985]);
%Foreign_Man_us_ch=[India Europe Canada Other];
Foreign_Man_us_ch=[9.04E-01	1.14E-02	2.14E-02	6.33E-02]/sum([9.04E-01	1.14E-02	2.14E-02	6.33E-02]);
%Foreign_Oth_us_us=[India Europe Canada China Other];
Foreign_Oth_us_us=[5.55E-01	7.22E-02	7.21E-02	9.35E-02	2.07E-01]/sum([5.55E-01	7.22E-02	7.21E-02	9.35E-02	2.07E-01]);
%Foreign_Fin_us_us=[India Europe Canada China Other];
Foreign_Fin_us_us=[5.92E-01	6.04E-02	5.67E-02	1.38E-01	1.53E-01]/sum([5.92E-01	6.04E-02	5.67E-02	1.38E-01	1.53E-01]);
%Foreign_Fin_us_in=[Europe Canada China Other];
Foreign_Fin_us_in=[5.45E-01	4.55E-02	4.55E-02	3.64E-01]/sum([5.45E-01	4.55E-02	4.55E-02	3.64E-01]);
%Foreign_Fin_us_eu=[India Canada China Other];
Foreign_Fin_us_eu=[5.33E-01	6.34E-02	1.32E-01	2.72E-01]/sum([5.33E-01	6.34E-02	1.32E-01	2.72E-01]);
%Foreign_Fin_us_ca=[India Europe China Other];
Foreign_Fin_us_ca=[4.67E-01	8.93E-02	2.16E-01	2.28E-01]/sum([4.67E-01	8.93E-02	2.16E-01	2.28E-01]);
%Foreign_Fin_us_ch=[India Europe Canada Other];
Foreign_Fin_us_ch=[2.86E-01	2.53E-01	6.24E-02	3.99E-01]/sum([2.86E-01	2.53E-01	6.24E-02	3.99E-01]);

%Foreign_IT_eu_us=[India Canada China Other];
Foreign_IT_eu_us=[0.040775758	0.026908212	0.045385793	0.886930237]/sum([0.040775758	0.026908212	0.045385793	0.886930237]);
%Foreign_IT_eu_in=[US Canada China Other];
Foreign_IT_eu_in=[0.073745025	0.025983356	0.043825848	0.85644577]/sum([0.073745025	0.025983356	0.043825848	0.85644577]);
%Foreign_IT_eu_eu=[India US Canada China Other];
Foreign_IT_eu_eu=[0.037882662	0.070951367	0.024999038	0.042165609	0.824001324]/sum([0.037882662	0.070951367	0.024999038	0.042165609	0.824001324]);
%Foreign_IT_eu_ca=[India US China Other];
Foreign_IT_eu_ca=[0.038853974	0.072770561	0.043246735	0.845128729]/sum([0.038853974	0.072770561	0.043246735	0.845128729]);
%Foreign_IT_eu_ch=[India US Canada Other];
Foreign_IT_eu_ch=[0.039550326	0.074074775	0.026099541	0.860275358]/sum([0.039550326	0.074074775	0.026099541	0.860275358]);
%Foreign_Man_eu_us=[India Canada China Other];
Foreign_Man_eu_us=[0.041913227	0.03029909	0.026826723	0.900960961]/sum([0.041913227	0.03029909	0.026826723	0.900960961]);
%Foreign_Man_eu_in=[US Canada China Other];
Foreign_Man_eu_in=[0.060354263	0.0297159	0.026310368	0.883619469]/sum([0.060354263	0.0297159	0.026310368	0.883619469]);
%Foreign_Man_eu_eu=[India US Canada China Other];
Foreign_Man_eu_eu=[0.039483464	0.057971268	0.028542613	0.025271544	0.848731112]/sum([0.039483464	0.057971268	0.028542613	0.025271544	0.848731112]);
%Foreign_Man_eu_ca=[India US China Other];
Foreign_Man_eu_ca=[0.040643536	0.059674535	0.026014053	0.873667876]/sum([0.040643536	0.059674535	0.026014053	0.873667876]);
%Foreign_Man_eu_ch=[India US Canada Other];
Foreign_Man_eu_ch=[0.040507142	0.059474274	0.02928263	0.870735954]/sum([0.040507142	0.059474274	0.02928263	0.870735954]);
%Foreign_Oth_eu_eu=[India US Canada China Other];
Foreign_Oth_eu_eu=[0.057164725	0.049781489	0.012453975	0.036753936	0.843845874]/sum([0.057164725	0.049781489	0.012453975	0.036753936	0.843845874]);
%Foreign_Fin_eu_us=[India Canada China Other];
Foreign_Fin_eu_us=[0.040782071	0.022664175	0.03864014	0.897913614]/sum([0.040782071	0.022664175	0.03864014	0.897913614]);
%Foreign_Fin_eu_in=[US Canada China Other];
Foreign_Fin_eu_in=[0.0740213	0.021878807	0.037301165	0.866798728]/sum([0.0740213	0.021878807	0.037301165	0.866798728]);
%Foreign_Fin_eu_eu=[India US Canada China Other];
Foreign_Fin_eu_eu=[0.035239243	0.066256775	0.089240388	0.033388429	0.775875165]/sum([0.035239243	0.066256775	0.089240388	0.033388429	0.775875165]);
%Foreign_Fin_eu_ca=[India US China Other];
Foreign_Fin_eu_ca=[0.039287638	0.073868561	0.021833661	0.86501014]/sum([0.039287638	0.073868561	0.021833661	0.86501014]);
%Foreign_Fin_eu_ch=[India US Canada Other];
Foreign_Fin_eu_ch=[0.039287638	0.073868561	0.021833661	0.86501014]/sum([0.039287638	0.073868561	0.021833661	0.86501014]);



%Foreign_IT_ca_us=[India Europe China Other];
Foreign_IT_ca_us=[0.098680748	0.186361828	0.122123992	0.592833431]/sum([0.098680748	0.186361828	0.122123992	0.592833431]);
%Foreign_IT_ca_in=[Europe US China Other];
Foreign_IT_ca_in=[0.195236225	0.055760668	0.127939436	0.621063671]/sum([0.195236225	0.055760668	0.127939436	0.621063671]);
%Foreign_IT_ca_eu=[India US China Other];
Foreign_IT_ca_eu=[0.113836448	0.061400715	0.140880179	0.683882657]/sum([0.113836448	0.061400715	0.140880179	0.683882657]);
%Foreign_IT_ca_ca=[India Europe US China Other];
Foreign_IT_ca_ca=[0.093693794	0.176943802	0.050536239	0.115952305	0.562873859]/sum([0.093693794	0.176943802	0.050536239	0.115952305	0.562873859]);
%Foreign_IT_ca_ch=[India Europe US Other];
Foreign_IT_ca_ch=[0.105982737	0.200151873	0.057164607	0.636700783]/sum([0.105982737	0.200151873	0.057164607	0.636700783]);
%Foreign_Man_ca_us=[India Europe China Other];
Foreign_Man_ca_us=[0.127466249	0.115200429	0.114465332	0.64286799]/sum([0.127466249	0.115200429	0.114465332	0.64286799]);
%Foreign_Man_ca_in=[Europe US China Other];
Foreign_Man_ca_in=[0.128658639	0.025533101	0.127837665	0.717970595]/sum([0.128658639	0.025533101	0.127837665	0.717970595]);
%Foreign_Man_ca_eu=[India US China Other];
Foreign_Man_ca_eu=[0.140433637	0.025188056	0.126110112	0.708268195]/sum([0.140433637	0.025188056	0.126110112	0.708268195]);
%Foreign_Man_ca_ca=[India Europe US China Other];
Foreign_Man_ca_ca=[0.124617221	0.112625557	0.022351237	0.11190689	0.628499095]/sum([0.124617221	0.112625557	0.022351237	0.11190689	0.628499095]);
%Foreign_Man_ca_ch=[India Europe US Other];
Foreign_Man_ca_ch=[0.140319995	0.126817285	0.025167673	0.707695047]/sum([0.140319995	0.126817285	0.025167673	0.707695047]);
%Foreign_Oth_ca_ca=[India Europe US China Other];
Foreign_Oth_ca_ca=[0.102886028	0.14767677	0.049258521	0.081493777	0.618684903]/sum([0.102886028	0.14767677	0.049258521	0.081493777	0.618684903]);
%Foreign_Fin_ca_us=[India Europe China Other];
Foreign_Fin_ca_us=[0.119635937	0.124164863	0.130040877	0.626158323]/sum([0.119635937	0.124164863	0.130040877	0.626158323]);
%Foreign_Fin_ca_in=[Europe US China Other];
Foreign_Fin_ca_in=[0.136122444	0.034853302	0.142564341	0.686459913]/sum([0.136122444	0.034853302	0.142564341	0.686459913]);
%Foreign_Fin_ca_eu=[India US China Other];
Foreign_Fin_ca_eu=[0.13181182	0.035027215	0.143275717	0.689885249]/sum([0.13181182	0.035027215	0.143275717	0.689885249]);
%Foreign_Fin_ca_ca=[India Europe US China Other];
Foreign_Fin_ca_ca=[0.115949706	0.120339086	0.030812072	0.126034048	0.606865088]/sum([0.115949706	0.120339086	0.030812072	0.126034048	0.606865088]);
%Foreign_Fin_ca_ch=[India Europe US Other];
Foreign_Fin_ca_ch=[0.132670736	0.137693106	0.03525546	0.694380699]/sum([0.132670736	0.137693106	0.03525546	0.694380699]);

Share_World_GDP=[0.183080478	0.026160154	0.241953416	0.022539325	0.171593075	0.354673553]/sum([0.183080478	0.026160154	0.241953416	0.022539325	0.171593075	0.354673553]);
share_population=[0.04887797	0.147100867	0.062325864	0.005943329	0.242025331	0.49372664]/sum([0.04887797	0.147100867	0.062325864	0.005943329	0.242025331	0.49372664]);



%Share of high skill and low skill in total wage bill by source and
%industry

broad_share_us=[2.48E-01	7.52E-01	2.48E-01	7.52E-01	2.48E-01	7.52E-01	2.48E-01	7.52E-01	2.48E-01	7.52E-01	4.48E-01	5.52E-01	4.48E-01	5.52E-01	4.48E-01	5.52E-01	4.48E-01	5.52E-01	4.48E-01	5.52E-01	5.48E-01	4.52E-01	3.14E-01	6.86E-01	3.14E-01	6.86E-01	3.14E-01	6.86E-01	3.14E-01	6.86E-01	3.14E-01	6.86E-01];
broad_share_eu=[0.415218196	0.584781804	0.415218196	0.584781804	0.415218196	0.584781804	0.415218196	0.584781804	0.415218196	0.584781804	0.575557262	0.424442738	0.575557262	0.424442738	0.575557262	0.424442738	0.575557262	0.424442738	0.575557262	0.424442738	0.647551157	0.352448843	0.372927626	0.627072374	0.372927626	0.627072374	0.372927626	0.627072374	0.372927626	0.627072374	0.372927626	0.627072374];
broad_share_ca=[0.351042805	0.648957195	0.351042805	0.648957195	0.351042805	0.648957195	0.351042805	0.648957195	0.351042805	0.648957195	0.716180871	0.283819129	0.716180871	0.283819129	0.716180871	0.283819129	0.716180871	0.283819129	0.716180871	0.283819129	0.583200428	0.416799572	0.628915901	0.371084099	0.628915901	0.371084099	0.628915901	0.371084099	0.628915901	0.371084099	0.628915901	0.371084099];
broad_share_in=[0.244330098	0.755669902	0.244330098	0.755669902	0.244330098	0.755669902	0.244330098	0.755669902	0.244330098	0.755669902	0.503763987	0.496236013	0.503763987	0.496236013	0.503763987	0.496236013	0.503763987	0.496236013	0.503763987	0.496236013	0.760367524	0.239632476	0.183509379	0.816490621	0.183509379	0.816490621	0.183509379	0.816490621	0.183509379	0.816490621	0.183509379	0.816490621];
broad_share_ch=[0.244330098	0.755669902	0.244330098	0.755669902	0.244330098	0.755669902	0.244330098	0.755669902	0.244330098	0.755669902	0.503763987	0.496236013	0.503763987	0.496236013	0.503763987	0.496236013	0.503763987	0.496236013	0.503763987	0.496236013	0.760367524	0.239632476	0.183509379	0.816490621	0.183509379	0.816490621	0.183509379	0.816490621	0.183509379	0.816490621	0.183509379	0.816490621];
broad_share_ot=[0.244330098	0.755669902	0.503763987	0.496236013	0.760367524	0.239632476	0.183509379	0.816490621];


%Intermediate input shares 

%Rows Country and Buying Industry US - IT, Man, Oth, Fin, IN- EU - CA- CH- OT -
%Columns Country-Industry buys from other industries - IT Man Oth Fin

int_imp_shares=[3.49E-02	1.75E-01	2.34E-02...
6.46E-02	2.60E-01	6.22E-03...
6.15E-02	3.17E-02	2.46E-02...
6.37E-02	4.17E-03	8.77E-02...
4.29E-02	1.40E-01	1.94E-02...
2.21E-02	3.70E-01	3.37E-02...
9.07E-03	3.54E-02	2.09E-02...
2.37E-02	1.06E-02	8.74E-02...
2.50E-02	2.00E-01	2.30E-02...
4.88E-02	3.31E-01	1.40E-02...
4.92E-02	3.20E-02	2.49E-02...
1.11E-01	4.46E-03	1.30E-01...
2.58E-02	2.25E-01	1.59E-02...
2.54E-02	2.88E-01	1.87E-02...
4.89E-02	3.66E-02	2.38E-02...
1.04E-01	5.98E-03	1.45E-01...
1.62E-01	2.59E-01	3.13E-02...
2.49E-02	3.24E-01	1.37E-02...
2.81E-02	7.95E-02	2.21E-02...
7.52E-02	5.14E-03	1.69E-01...
4.82E-02	2.00E-01	2.68E-02...
3.49E-02	3.44E-01	1.48E-02...
3.37E-02	4.47E-02	2.30E-02...
1.07E-01	6.16E-03	1.38E-01];



gamma_us_IT_Man=int_imp_shares(1,1);
gamma_us_IT_Oth=int_imp_shares(1,2);
gamma_us_IT_Fin=int_imp_shares(1,3);
gamma_us_IT_L=1-int_imp_shares(1,1)-int_imp_shares(1,2)-int_imp_shares(1,3);

gamma_us_Man_IT=int_imp_shares(1,4);
gamma_us_Man_Oth=int_imp_shares(1,5);
gamma_us_Man_Fin=int_imp_shares(1,6);
gamma_us_Man_L=1-int_imp_shares(1,4)-int_imp_shares(1,5)-int_imp_shares(1,6);

gamma_us_Oth_IT=int_imp_shares(1,7);
gamma_us_Oth_Man=int_imp_shares(1,8);
gamma_us_Oth_Fin=int_imp_shares(1,9);
gamma_us_Oth_L=1-int_imp_shares(1,7)-int_imp_shares(1,8)-int_imp_shares(1,9);

gamma_us_Fin_IT=int_imp_shares(1,10);
gamma_us_Fin_Man=int_imp_shares(1,11);
gamma_us_Fin_Oth=int_imp_shares(1,12);
gamma_us_Fin_L=1-int_imp_shares(1,10)-int_imp_shares(1,11)-int_imp_shares(1,12);




gamma_in_IT_Man=int_imp_shares(1,13);
gamma_in_IT_Oth=int_imp_shares(1,14);
gamma_in_IT_Fin=int_imp_shares(1,15);
gamma_in_IT_L=1-int_imp_shares(1,13)-int_imp_shares(1,14)-int_imp_shares(1,15);

gamma_in_Man_IT=int_imp_shares(1,16);
gamma_in_Man_Oth=int_imp_shares(1,17);
gamma_in_Man_Fin=int_imp_shares(1,18);
gamma_in_Man_L=1-int_imp_shares(1,16)-int_imp_shares(1,17)-int_imp_shares(1,18);

gamma_in_Oth_IT=int_imp_shares(1,19);
gamma_in_Oth_Man=int_imp_shares(1,20);
gamma_in_Oth_Fin=int_imp_shares(1,21);
gamma_in_Oth_L=1-int_imp_shares(1,19)-int_imp_shares(1,20)-int_imp_shares(1,21);

gamma_in_Fin_IT=int_imp_shares(1,22);
gamma_in_Fin_Man=int_imp_shares(1,23);
gamma_in_Fin_Oth=int_imp_shares(1,24);
gamma_in_Fin_L=1-int_imp_shares(1,22)-int_imp_shares(1,23)-int_imp_shares(1,24);


gamma_eu_IT_Man=int_imp_shares(1,25);
gamma_eu_IT_Oth=int_imp_shares(1,26);
gamma_eu_IT_Fin=int_imp_shares(1,27);
gamma_eu_IT_L=1-int_imp_shares(1,25)-int_imp_shares(1,26)-int_imp_shares(1,27);

gamma_eu_Man_IT=int_imp_shares(1,28);
gamma_eu_Man_Oth=int_imp_shares(1,29);
gamma_eu_Man_Fin=int_imp_shares(1,30);
gamma_eu_Man_L=1-int_imp_shares(1,28)-int_imp_shares(1,29)-int_imp_shares(1,30);

gamma_eu_Oth_IT=int_imp_shares(1,31);
gamma_eu_Oth_Man=int_imp_shares(1,32);
gamma_eu_Oth_Fin=int_imp_shares(1,33);
gamma_eu_Oth_L=1-int_imp_shares(1,31)-int_imp_shares(1,32)-int_imp_shares(1,33);

gamma_eu_Fin_IT=int_imp_shares(1,34);
gamma_eu_Fin_Man=int_imp_shares(1,35);
gamma_eu_Fin_Oth=int_imp_shares(1,36);
gamma_eu_Fin_L=1-int_imp_shares(1,34)-int_imp_shares(1,35)-int_imp_shares(1,36);


gamma_ca_IT_Man=int_imp_shares(1,37);
gamma_ca_IT_Oth=int_imp_shares(1,38);
gamma_ca_IT_Fin=int_imp_shares(1,39);
gamma_ca_IT_L=1-int_imp_shares(1,37)-int_imp_shares(1,38)-int_imp_shares(1,39);

gamma_ca_Man_IT=int_imp_shares(1,40);
gamma_ca_Man_Oth=int_imp_shares(1,41);
gamma_ca_Man_Fin=int_imp_shares(1,42);
gamma_ca_Man_L=1-int_imp_shares(1,40)-int_imp_shares(1,41)-int_imp_shares(1,42);

gamma_ca_Oth_IT=int_imp_shares(1,43);
gamma_ca_Oth_Man=int_imp_shares(1,44);
gamma_ca_Oth_Fin=int_imp_shares(1,45);
gamma_ca_Oth_L=1-int_imp_shares(1,43)-int_imp_shares(1,44)-int_imp_shares(1,45);

gamma_ca_Fin_IT=int_imp_shares(1,46);
gamma_ca_Fin_Man=int_imp_shares(1,47);
gamma_ca_Fin_Oth=int_imp_shares(1,48);
gamma_ca_Fin_L=1-int_imp_shares(1,46)-int_imp_shares(1,47)-int_imp_shares(1,48);

gamma_ch_IT_Man=int_imp_shares(1,49);
gamma_ch_IT_Oth=int_imp_shares(1,50);
gamma_ch_IT_Fin=int_imp_shares(1,51);
gamma_ch_IT_L=1-int_imp_shares(1,49)-int_imp_shares(1,50)-int_imp_shares(1,51);

gamma_ch_Man_IT=int_imp_shares(1,52);
gamma_ch_Man_Oth=int_imp_shares(1,53);
gamma_ch_Man_Fin=int_imp_shares(1,54);
gamma_ch_Man_L=1-int_imp_shares(1,52)-int_imp_shares(1,53)-int_imp_shares(1,54);

gamma_ch_Oth_IT=int_imp_shares(1,55);
gamma_ch_Oth_Man=int_imp_shares(1,56);
gamma_ch_Oth_Fin=int_imp_shares(1,57);
gamma_ch_Oth_L=1-int_imp_shares(1,55)-int_imp_shares(1,56)-int_imp_shares(1,57);

gamma_ch_Fin_IT=int_imp_shares(1,58);
gamma_ch_Fin_Man=int_imp_shares(1,59);
gamma_ch_Fin_Oth=int_imp_shares(1,60);
gamma_ch_Fin_L=1-int_imp_shares(1,58)-int_imp_shares(1,59)-int_imp_shares(1,60);


gamma_ot_IT_Man=int_imp_shares(1,61);
gamma_ot_IT_Oth=int_imp_shares(1,62);
gamma_ot_IT_Fin=int_imp_shares(1,63);
gamma_ot_IT_L=1-int_imp_shares(1,61)-int_imp_shares(1,62)-int_imp_shares(1,63);

gamma_ot_Man_IT=int_imp_shares(1,64);
gamma_ot_Man_Oth=int_imp_shares(1,65);
gamma_ot_Man_Fin=int_imp_shares(1,66);
gamma_ot_Man_L=1-int_imp_shares(1,64)-int_imp_shares(1,65)-int_imp_shares(1,66);

gamma_ot_Oth_IT=int_imp_shares(1,67);
gamma_ot_Oth_Man=int_imp_shares(1,68);
gamma_ot_Oth_Fin=int_imp_shares(1,69);
gamma_ot_Oth_L=1-int_imp_shares(1,67)-int_imp_shares(1,68)-int_imp_shares(1,69);

gamma_ot_Fin_IT=int_imp_shares(1,70);
gamma_ot_Fin_Man=int_imp_shares(1,71);
gamma_ot_Fin_Oth=int_imp_shares(1,72);
gamma_ot_Fin_L=1-int_imp_shares(1,70)-int_imp_shares(1,71)-int_imp_shares(1,72);



%Loop begins here

%Outer loop: Determine magnitude of the migration cost change

wage=ones(1,198);

adjust2=0.5;
max_iter2 = 10^(6);
omega_tol2 = 10^(-3);
omega_crit2 = 10^3;
omega_iter2 = 0;


while omega_crit2 > omega_tol2 & omega_iter2 < max_iter2
    omega_iter2 = omega_iter2 + 1;


%Migration costs


phi_in_us_us=mig_cost_change;
phi_in_us_in=mig_cost_change;
phi_in_us_eu=mig_cost_change;
phi_in_us_ca=mig_cost_change;
phi_in_us_ch=mig_cost_change;


phi_in_eu_us=1;
phi_in_eu_in=1;
phi_in_eu_eu=1;
phi_in_eu_ca=1;
phi_in_eu_ch=1;

phi_in_ca_us=1;
phi_in_ca_in=1;
phi_in_ca_eu=1;
phi_in_ca_ca=1;
phi_in_ca_ch=1;



phi_ch_us_us=mig_cost_change;
phi_ch_us_in=mig_cost_change;
phi_ch_us_eu=mig_cost_change;
phi_ch_us_ca=mig_cost_change;
phi_ch_us_ch=mig_cost_change;


phi_ch_eu_us=1;
phi_ch_eu_in=1;
phi_ch_eu_eu=1;
phi_ch_eu_ca=1;
phi_ch_eu_ch=1;

phi_ch_ca_us=1;
phi_ch_ca_in=1;
phi_ch_ca_eu=1;
phi_ch_ca_ca=1;
phi_ch_ca_ch=1;


phi_ot_us_us=mig_cost_change;
phi_ot_us_in=mig_cost_change;
phi_ot_us_eu=mig_cost_change;
phi_ot_us_ca=mig_cost_change;
phi_ot_us_ch=mig_cost_change;


phi_ot_eu_us=1;
phi_ot_eu_in=1;
phi_ot_eu_eu=1;
phi_ot_eu_ca=1;
phi_ot_eu_ch=1;

phi_ot_ca_us=1;
phi_ot_ca_in=1;
phi_ot_ca_eu=1;
phi_ot_ca_ca=1;
phi_ot_ca_ch=1;

phi_us_eu_us=1;
phi_us_eu_in=1;
phi_us_eu_eu=1;
phi_us_eu_ca=1;
phi_us_eu_ch=1;

phi_us_ca_us=1;
phi_us_ca_in=1;
phi_us_ca_eu=1;
phi_us_ca_ca=1;
phi_us_ca_ch=1;


phi_eu_ca_us=1;
phi_eu_ca_in=1;
phi_eu_ca_eu=1;
phi_eu_ca_ca=1;
phi_eu_ca_ch=1;

phi_eu_us_us=mig_cost_change;
phi_eu_us_in=mig_cost_change;
phi_eu_us_eu=mig_cost_change;
phi_eu_us_ca=mig_cost_change;
phi_eu_us_ch=mig_cost_change;

phi_ca_us_us=mig_cost_change;
phi_ca_us_in=mig_cost_change;
phi_ca_us_eu=mig_cost_change;
phi_ca_us_ca=mig_cost_change;
phi_ca_us_ch=mig_cost_change;

phi_ca_eu_us=1;
phi_ca_eu_in=1;
phi_ca_eu_eu=1;
phi_ca_eu_ca=1;
phi_ca_eu_ch=1;

%Interior Loop starts here - to find equilibrium prices and wages

ajust=0.01;
max_iter = 10^(6);
omega_tol = 10^(-5);
omega_crit = 10^3;
omega_iter = 0;


while omega_crit > omega_tol & omega_iter < max_iter
    omega_iter = omega_iter + 1;

w_us_IT_us_d=wage(1,1);
w_us_IT_us_f=wage(1,2);
w_us_Man_us_d=wage(1,3);
w_us_Man_us_f=wage(1,4);
w_us_Oth_us_d=wage(1,5);
w_us_Oth_us_f=wage(1,6);
w_us_IT_eu_d=wage(1,7);
w_us_IT_eu_s=wage(1,8);
w_us_IT_eu_f=wage(1,9);
w_us_Man_eu_d=wage(1,10);
w_us_Man_eu_s=wage(1,11);
w_us_Man_eu_f=wage(1,12);
w_us_IT_ca_d=wage(1,13);
w_us_IT_ca_s=wage(1,14);
w_us_IT_ca_f=wage(1,15);
w_us_Man_ca_d=wage(1,16);
w_us_Man_ca_s=wage(1,17);
w_us_Man_ca_f=wage(1,18);
w_us_IT_in_d=wage(1,19);
w_us_IT_in_s=wage(1,20);
w_us_IT_in_f=wage(1,21);
w_us_Man_in_d=wage(1,22);
w_us_Man_in_s=wage(1,23);
w_us_Man_in_f=wage(1,24);
w_us_IT_ch_d=wage(1,25);
w_us_IT_ch_s=wage(1,26);
w_us_IT_ch_f=wage(1,27);
w_us_Man_ch_d=wage(1,28);
w_us_Man_ch_s=wage(1,29);
w_us_Man_ch_f=wage(1,30);
w_eu_IT_eu_d=wage(1,31);
w_eu_IT_eu_f=wage(1,32);
w_eu_Man_eu_d=wage(1,33);
w_eu_Man_eu_f=wage(1,34);
w_eu_Oth_eu_d=wage(1,35);
w_eu_Oth_eu_f=wage(1,36);
w_eu_IT_us_d=wage(1,37);
w_eu_IT_us_s=wage(1,38);
w_eu_IT_us_f=wage(1,39);
w_eu_Man_us_d=wage(1,40);
w_eu_Man_us_s=wage(1,41);
w_eu_Man_us_f=wage(1,42);
w_eu_IT_ca_d=wage(1,43);
w_eu_IT_ca_s=wage(1,44);
w_eu_IT_ca_f=wage(1,45);
w_eu_Man_ca_d=wage(1,46);
w_eu_Man_ca_s=wage(1,47);
w_eu_Man_ca_f=wage(1,48);
w_eu_IT_in_d=wage(1,49);
w_eu_IT_in_s=wage(1,50);
w_eu_IT_in_f=wage(1,51);
w_eu_Man_in_d=wage(1,52);
w_eu_Man_in_s=wage(1,53);
w_eu_Man_in_f=wage(1,54);
w_eu_IT_ch_d=wage(1,55);
w_eu_IT_ch_s=wage(1,56);
w_eu_IT_ch_f=wage(1,57);
w_eu_Man_ch_d=wage(1,58);
w_eu_Man_ch_s=wage(1,59);
w_eu_Man_ch_f=wage(1,60);
w_ca_IT_ca_d=wage(1,61);
w_ca_IT_ca_f=wage(1,62);
w_ca_Man_ca_d=wage(1,63);
w_ca_Man_ca_f=wage(1,64);
w_ca_Oth_ca_d=wage(1,65);
w_ca_Oth_ca_f=wage(1,66);
w_ca_IT_us_d=wage(1,67);
w_ca_IT_us_s=wage(1,68);
w_ca_IT_us_f=wage(1,69);
w_ca_Man_us_d=wage(1,70);
w_ca_Man_us_s=wage(1,71);
w_ca_Man_us_f=wage(1,72);
w_ca_IT_eu_d=wage(1,73);
w_ca_IT_eu_s=wage(1,74);
w_ca_IT_eu_f=wage(1,75);
w_ca_Man_eu_d=wage(1,76);
w_ca_Man_eu_s=wage(1,77);
w_ca_Man_eu_f=wage(1,78);
w_ca_IT_in_d=wage(1,79);
w_ca_IT_in_s=wage(1,80);
w_ca_IT_in_f=wage(1,81);
w_ca_Man_in_d=wage(1,82);
w_ca_Man_in_s=wage(1,83);
w_ca_Man_in_f=wage(1,84);
w_ca_IT_ch_d=wage(1,85);
w_ca_IT_ch_s=wage(1,86);
w_ca_IT_ch_f=wage(1,87);
w_ca_Man_ch_d=wage(1,88);
w_ca_Man_ch_s=wage(1,89);
w_ca_Man_ch_f=wage(1,90);
w_in_IT_us=wage(1,91);
w_in_IT_in=wage(1,92);
w_in_IT_eu=wage(1,93);
w_in_IT_ca=wage(1,94);
w_in_IT_ch=wage(1,95);
w_in_Man_us=wage(1,96);
w_in_Man_in=wage(1,97);
w_in_Man_eu=wage(1,98);
w_in_Man_ca=wage(1,99);
w_in_Man_ch=wage(1,100);
w_in_Oth_in=wage(1,101);
w_ch_IT_us=wage(1,102);
w_ch_IT_in=wage(1,103);
w_ch_IT_eu=wage(1,104);
w_ch_IT_ca=wage(1,105);
w_ch_IT_ch=wage(1,106);
w_ch_Man_us=wage(1,107);
w_ch_Man_in=wage(1,108);
w_ch_Man_eu=wage(1,109);
w_ch_Man_ca=wage(1,110);
w_ch_Man_ch=wage(1,111);
w_ch_Oth_ch=wage(1,112);
w_ot_IT_ot=wage(1,113);
w_ot_Man_ot=wage(1,114);
w_ot_Oth_ot=wage(1,115);
w_us_L=wage(1,116);
w_in_L=wage(1,117);
w_eu_L=wage(1,118);
w_ca_L=wage(1,119);
w_ch_L=wage(1,120);
w_ot_L=wage(1,121);


p_us_IT_alt=wage(1,122); 
p_us_Man_alt=wage(1,123); 
p_us_Oth_alt=wage(1,124); 
p_in_IT_alt=wage(1,125); 
p_in_Man_alt=wage(1,126); 
p_in_Oth_alt=wage(1,127); 
p_eu_IT_alt=wage(1,128); 
p_eu_Man_alt=wage(1,129); 
p_eu_Oth_alt=wage(1,130); 
p_ca_IT_alt=wage(1,131); 
p_ca_Man_alt=wage(1,132); 
p_ca_Oth_alt=wage(1,133); 
p_ch_IT_alt=wage(1,134); 
p_ch_Man_alt=wage(1,135); 
p_ch_Oth_alt=wage(1,136); 
p_ot_IT_alt=wage(1,137); 
p_ot_Man_alt=wage(1,138); 
p_ot_Oth_alt=wage(1,139);



w_us_Fin_us_d=wage(1,140);
w_us_Fin_us_f=wage(1,141);
w_us_Fin_eu_d=wage(1,142);
w_us_Fin_eu_s=wage(1,143);
w_us_Fin_eu_f=wage(1,144);
w_us_Fin_ca_d=wage(1,145);
w_us_Fin_ca_s=wage(1,146);
w_us_Fin_ca_f=wage(1,147);
w_us_Fin_in_d=wage(1,148);
w_us_Fin_in_s=wage(1,149);
w_us_Fin_in_f=wage(1,150);
w_us_Fin_ch_d=wage(1,151);
w_us_Fin_ch_s=wage(1,152);
w_us_Fin_ch_f=wage(1,153);
w_eu_Fin_eu_d=wage(1,154);
w_eu_Fin_eu_f=wage(1,155);
w_eu_Fin_us_d=wage(1,156);
w_eu_Fin_us_s=wage(1,157);
w_eu_Fin_us_f=wage(1,158);
w_eu_Fin_ca_d=wage(1,159);
w_eu_Fin_ca_s=wage(1,160);
w_eu_Fin_ca_f=wage(1,161);
w_eu_Fin_in_d=wage(1,162);
w_eu_Fin_in_s=wage(1,163);
w_eu_Fin_in_f=wage(1,164);
w_eu_Fin_ch_d=wage(1,165);
w_eu_Fin_ch_s=wage(1,166);
w_eu_Fin_ch_f=wage(1,167);
w_ca_Fin_ca_d=wage(1,168);
w_ca_Fin_ca_f=wage(1,169);
w_ca_Fin_us_d=wage(1,170);
w_ca_Fin_us_s=wage(1,171);
w_ca_Fin_us_f=wage(1,172);
w_ca_Fin_eu_d=wage(1,173);
w_ca_Fin_eu_s=wage(1,174);
w_ca_Fin_eu_f=wage(1,175);
w_ca_Fin_in_d=wage(1,176);
w_ca_Fin_in_s=wage(1,177);
w_ca_Fin_in_f=wage(1,178);
w_ca_Fin_ch_d=wage(1,179);
w_ca_Fin_ch_s=wage(1,180);
w_ca_Fin_ch_f=wage(1,181);
w_in_Fin_us=wage(1,182);
w_in_Fin_in=wage(1,183);
w_in_Fin_eu=wage(1,184);
w_in_Fin_ca=wage(1,185);
w_in_Fin_ch=wage(1,186);
w_ch_Fin_us=wage(1,187);
w_ch_Fin_in=wage(1,188);
w_ch_Fin_eu=wage(1,189);
w_ch_Fin_ca=wage(1,190);
w_ch_Fin_ch=wage(1,191);
w_ot_Fin_ot=wage(1,192);
p_us_Fin_alt=wage(1,193); 
p_in_Fin_alt=wage(1,194); 
p_eu_Fin_alt=wage(1,195); 
p_ca_Fin_alt=wage(1,196);
p_ch_Fin_alt=wage(1,197); 
p_ot_Fin_alt=wage(1,198);







%Consumption shares by sector
gamma=[1.22E-01	9.68E-02	7.15E-01	6.57E-02];
gamma_eu=[1.06E-01	9.57E-02	7.46E-01	5.24E-02];
gamma_in=[2.15E-02	1.18E-01	8.28E-01	3.27E-02];
gamma_ch=[4.38E-02	2.24E-01	7.06E-01	2.69E-02];
gamma_ot=[6.69E-02	1.29E-01	7.62E-01	4.13E-02];
gamma_ca=[8.61E-02	9.07E-02	7.66E-01	5.68E-02];

price_deflator_us=p_us_IT_alt^gamma(1,1)*p_us_Man_alt^gamma(1,2)*p_us_Oth_alt^gamma(1,3)*p_us_Fin_alt^gamma(1,4);
price_deflator_in=p_in_IT_alt^gamma_in(1,1)*p_in_Man_alt^gamma_in(1,2)*p_in_Oth_alt^gamma_in(1,3)*p_in_Fin_alt^gamma_in(1,4);
price_deflator_eu=p_eu_IT_alt^gamma_eu(1,1)*p_eu_Man_alt^gamma_eu(1,2)*p_eu_Oth_alt^gamma_eu(1,3)*p_eu_Fin_alt^gamma_eu(1,4);
price_deflator_ca=p_ca_IT_alt^gamma_ca(1,1)*p_ca_Man_alt^gamma_ca(1,2)*p_ca_Oth_alt^gamma_ca(1,3)*p_ca_Fin_alt^gamma_ca(1,4);
price_deflator_ch=p_ch_IT_alt^gamma_ch(1,1)*p_ch_Man_alt^gamma_ch(1,2)*p_ch_Oth_alt^gamma_ch(1,3)*p_ch_Fin_alt^gamma_ch(1,4);
price_deflator_ot=p_ot_IT_alt^gamma_ot(1,1)*p_ot_Man_alt^gamma_ot(1,2)*p_ot_Oth_alt^gamma_ot(1,3)*p_ot_Fin_alt^gamma_ot(1,4);


%Migration probabilities


%US workers
us_options=A_us_IT*(w_us_IT_us_d/price_deflator_us)^kappa*mig_us(1,1)+A_us_IT*(w_us_IT_in_d/price_deflator_us)^kappa*mig_us(1,2)+A_us_IT*(w_us_IT_eu_d/price_deflator_us)^kappa*mig_us(1,3)...
    +A_us_IT*(w_us_IT_ca_d/price_deflator_us)^kappa*mig_us(1,4)+A_us_IT*(w_us_IT_ch_d/price_deflator_us)^kappa*mig_us(1,5)+A_us_Man*(w_us_Man_us_d/price_deflator_us)^kappa*mig_us(1,6)...
    +A_us_Man*(w_us_Man_in_d/price_deflator_us)^kappa*mig_us(1,7)+A_us_Man*(w_us_Man_eu_d/price_deflator_us)^kappa*mig_us(1,8)+A_us_Man*(w_us_Man_ca_d/price_deflator_us)^kappa*mig_us(1,9)...
    +A_us_Man*(w_us_Man_ch_d/price_deflator_us)^kappa*mig_us(1,10)+A_us_Oth*(w_us_Oth_us_d/price_deflator_us)^kappa*mig_us(1,11)...
    +A_us_IT*(w_eu_IT_us_s/price_deflator_eu)^kappa*phi_us_eu_us^(-kappa)*mig_us(1,12)...
    +A_us_IT*(w_eu_IT_in_f/price_deflator_eu)^kappa*phi_us_eu_in^(-kappa)*mig_us(1,13)+A_us_IT*(w_eu_IT_eu_f/price_deflator_eu)^kappa*phi_us_eu_eu^(-kappa)*mig_us(1,14)...
    +A_us_IT*(w_eu_IT_ca_f/price_deflator_eu)^kappa*phi_us_eu_ca^(-kappa)*mig_us(1,15)+A_us_IT*(w_eu_IT_ch_f/price_deflator_eu)^kappa*phi_us_eu_ch^(-kappa)*mig_us(1,16)...
    +A_us_Man*(w_eu_Man_us_s/price_deflator_eu)^kappa*phi_us_eu_us^(-kappa)*mig_us(1,17)+A_us_Man*(w_eu_Man_in_f/price_deflator_eu)^kappa*phi_us_eu_in^(-kappa)*mig_us(1,18)...
    +A_us_Man*(w_eu_Man_eu_f/price_deflator_eu)^kappa*phi_us_eu_eu^(-kappa)*mig_us(1,19)+A_us_Man*(w_eu_Man_ca_f/price_deflator_eu)^kappa*phi_us_eu_ca^(-kappa)*mig_us(1,20)...
    +A_us_Man*(w_eu_Man_ch_f/price_deflator_eu)^kappa*phi_us_eu_ch^(-kappa)*mig_us(1,21)+A_us_Oth*(w_eu_Oth_eu_f/price_deflator_eu)^kappa*phi_us_eu_eu^(-kappa)*mig_us(1,22)...
    +A_us_IT*(w_ca_IT_us_s/price_deflator_ca)^kappa*phi_us_ca_us^(-kappa)*mig_us(1,23)...
    +A_us_IT*(w_ca_IT_in_f/price_deflator_ca)^kappa*phi_us_ca_in^(-kappa)*mig_us(1,24)+A_us_IT*(w_ca_IT_eu_f/price_deflator_ca)^kappa*phi_us_ca_eu^(-kappa)*mig_us(1,25)...
    +A_us_IT*(w_ca_IT_ca_f/price_deflator_ca)^kappa*phi_us_ca_ca^(-kappa)*mig_us(1,26)+A_us_IT*(w_ca_IT_ch_f/price_deflator_ca)^kappa*phi_us_ca_ch^(-kappa)*mig_us(1,27)...
    +A_us_Man*(w_ca_Man_us_s/price_deflator_ca)^kappa*phi_us_ca_us^(-kappa)*mig_us(1,28)+A_us_Man*(w_ca_Man_in_f/price_deflator_ca)^kappa*phi_us_ca_in^(-kappa)*mig_us(1,29)...
    +A_us_Man*(w_ca_Man_eu_f/price_deflator_ca)^kappa*phi_us_ca_eu^(-kappa)*mig_us(1,30)+A_us_Man*(w_ca_Man_ca_f/price_deflator_ca)^kappa*phi_us_ca_ca^(-kappa)*mig_us(1,31)...
    +A_us_Man*(w_ca_Man_ch_f/price_deflator_ca)^kappa*phi_us_ca_ch^(-kappa)*mig_us(1,32)+A_us_Oth*(w_ca_Oth_ca_f/price_deflator_ca)^kappa*phi_us_ca_ca^(-kappa)*mig_us(1,33)...
    +A_us_Fin*(w_us_Fin_us_d/price_deflator_us)^kappa*mig_us(1,34)+A_us_Fin*(w_us_Fin_in_d/price_deflator_us)^kappa*mig_us(1,35)+A_us_Fin*(w_us_Fin_eu_d/price_deflator_us)^kappa*mig_us(1,36)...
    +A_us_Fin*(w_us_Fin_ca_d/price_deflator_us)^kappa*mig_us(1,37)+A_us_Fin*(w_us_Fin_ch_d/price_deflator_us)^kappa*mig_us(1,38)...
    +A_us_Fin*(w_eu_Fin_us_s/price_deflator_eu)^kappa*phi_us_eu_us^(-kappa)*mig_us(1,39)+A_us_Fin*(w_eu_Fin_in_f/price_deflator_eu)^kappa*phi_us_eu_in^(-kappa)*mig_us(1,40)...
    +A_us_Fin*(w_eu_Fin_eu_f/price_deflator_eu)^kappa*phi_us_eu_eu^(-kappa)*mig_us(1,41)+A_us_Fin*(w_eu_Fin_ca_f/price_deflator_eu)^kappa*phi_us_eu_ca^(-kappa)*mig_us(1,42)...
    +A_us_Fin*(w_eu_Fin_ch_f/price_deflator_eu)^kappa*phi_us_eu_ch^(-kappa)*mig_us(1,43)...
    +A_us_Fin*(w_ca_Fin_us_s/price_deflator_ca)^kappa*phi_us_ca_us^(-kappa)*mig_us(1,44)+A_us_Fin*(w_ca_Fin_in_f/price_deflator_ca)^kappa*phi_us_ca_in^(-kappa)*mig_us(1,45)...
    +A_us_Fin*(w_ca_Fin_eu_f/price_deflator_ca)^kappa*phi_us_ca_eu^(-kappa)*mig_us(1,46)+A_us_Fin*(w_ca_Fin_ca_f/price_deflator_ca)^kappa*phi_us_ca_ca^(-kappa)*mig_us(1,47)...
    +A_us_Fin*(w_ca_Fin_ch_f/price_deflator_ca)^kappa*phi_us_ca_ch^(-kappa)*mig_us(1,48);




mig_us_IT_us_us=A_us_IT*(w_us_IT_us_d/price_deflator_us)^kappa/us_options;
mig_us_IT_us_in=A_us_IT*(w_us_IT_in_d/price_deflator_us)^kappa/us_options;
mig_us_IT_us_eu=A_us_IT*(w_us_IT_eu_d/price_deflator_us)^kappa/us_options;
mig_us_IT_us_ca=A_us_IT*(w_us_IT_ca_d/price_deflator_us)^kappa/us_options;
mig_us_IT_us_ch=A_us_IT*(w_us_IT_ch_d/price_deflator_us)^kappa/us_options;

mig_us_Man_us_us=A_us_Man*(w_us_Man_us_d/price_deflator_us)^kappa/us_options;
mig_us_Man_us_in=A_us_Man*(w_us_Man_in_d/price_deflator_us)^kappa/us_options;
mig_us_Man_us_eu=A_us_Man*(w_us_Man_eu_d/price_deflator_us)^kappa/us_options;
mig_us_Man_us_ca=A_us_Man*(w_us_Man_ca_d/price_deflator_us)^kappa/us_options;
mig_us_Man_us_ch=A_us_Man*(w_us_Man_ch_d/price_deflator_us)^kappa/us_options;

mig_us_Oth_us_us=A_us_Oth*(w_us_Oth_us_d/price_deflator_us)^kappa/us_options;


mig_us_Fin_us_us=A_us_Fin*(w_us_Fin_us_d/price_deflator_us)^kappa/us_options;
mig_us_Fin_us_in=A_us_Fin*(w_us_Fin_in_d/price_deflator_us)^kappa/us_options;
mig_us_Fin_us_eu=A_us_Fin*(w_us_Fin_eu_d/price_deflator_us)^kappa/us_options;
mig_us_Fin_us_ca=A_us_Fin*(w_us_Fin_ca_d/price_deflator_us)^kappa/us_options;
mig_us_Fin_us_ch=A_us_Fin*(w_us_Fin_ch_d/price_deflator_us)^kappa/us_options;


mig_us_IT_eu_us=A_us_IT*(w_eu_IT_us_s/price_deflator_eu)^kappa*phi_us_eu_us^(-kappa)/us_options;
mig_us_IT_eu_in=A_us_IT*(w_eu_IT_in_f/price_deflator_eu)^kappa*phi_us_eu_in^(-kappa)/us_options;
mig_us_IT_eu_eu=A_us_IT*(w_eu_IT_eu_f/price_deflator_eu)^kappa*phi_us_eu_eu^(-kappa)/us_options;
mig_us_IT_eu_ca=A_us_IT*(w_eu_IT_ca_f/price_deflator_eu)^kappa*phi_us_eu_ca^(-kappa)/us_options;
mig_us_IT_eu_ch=A_us_IT*(w_eu_IT_ch_f/price_deflator_eu)^kappa*phi_us_eu_ch^(-kappa)/us_options;

mig_us_Man_eu_us=A_us_Man*(w_eu_Man_us_s/price_deflator_eu)^kappa*phi_us_eu_us^(-kappa)/us_options;
mig_us_Man_eu_in=A_us_Man*(w_eu_Man_in_f/price_deflator_eu)^kappa*phi_us_eu_in^(-kappa)/us_options;
mig_us_Man_eu_eu=A_us_Man*(w_eu_Man_eu_f/price_deflator_eu)^kappa*phi_us_eu_eu^(-kappa)/us_options;
mig_us_Man_eu_ca=A_us_Man*(w_eu_Man_ca_f/price_deflator_eu)^kappa*phi_us_eu_ca^(-kappa)/us_options;
mig_us_Man_eu_ch=A_us_Man*(w_eu_Man_ch_f/price_deflator_eu)^kappa*phi_us_eu_ch^(-kappa)/us_options;

mig_us_Oth_eu_eu=A_us_Oth*(w_eu_Oth_eu_f/price_deflator_eu)^kappa*phi_us_eu_eu^(-kappa)/us_options;

mig_us_Fin_eu_us=A_us_Fin*(w_eu_Fin_us_s/price_deflator_eu)^kappa*phi_us_eu_us^(-kappa)/us_options;
mig_us_Fin_eu_in=A_us_Fin*(w_eu_Fin_in_f/price_deflator_eu)^kappa*phi_us_eu_in^(-kappa)/us_options;
mig_us_Fin_eu_eu=A_us_Fin*(w_eu_Fin_eu_f/price_deflator_eu)^kappa*phi_us_eu_eu^(-kappa)/us_options;
mig_us_Fin_eu_ca=A_us_Fin*(w_eu_Fin_ca_f/price_deflator_eu)^kappa*phi_us_eu_ca^(-kappa)/us_options;
mig_us_Fin_eu_ch=A_us_Fin*(w_eu_Fin_ch_f/price_deflator_eu)^kappa*phi_us_eu_ch^(-kappa)/us_options;



mig_us_IT_ca_us=A_us_IT*(w_ca_IT_us_s/price_deflator_ca)^kappa*phi_us_ca_us^(-kappa)/us_options;
mig_us_IT_ca_in=A_us_IT*(w_ca_IT_in_f/price_deflator_ca)^kappa*phi_us_ca_in^(-kappa)/us_options;
mig_us_IT_ca_eu=A_us_IT*(w_ca_IT_eu_f/price_deflator_ca)^kappa*phi_us_ca_eu^(-kappa)/us_options;
mig_us_IT_ca_ca=A_us_IT*(w_ca_IT_ca_f/price_deflator_ca)^kappa*phi_us_ca_ca^(-kappa)/us_options;
mig_us_IT_ca_ch=A_us_IT*(w_ca_IT_ch_f/price_deflator_ca)^kappa*phi_us_ca_ch^(-kappa)/us_options;

mig_us_Man_ca_us=A_us_Man*(w_ca_Man_us_s/price_deflator_ca)^kappa*phi_us_ca_us^(-kappa)/us_options;
mig_us_Man_ca_in=A_us_Man*(w_ca_Man_in_f/price_deflator_ca)^kappa*phi_us_ca_in^(-kappa)/us_options;
mig_us_Man_ca_eu=A_us_Man*(w_ca_Man_eu_f/price_deflator_ca)^kappa*phi_us_ca_eu^(-kappa)/us_options;
mig_us_Man_ca_ca=A_us_Man*(w_ca_Man_ca_f/price_deflator_ca)^kappa*phi_us_ca_ca^(-kappa)/us_options;
mig_us_Man_ca_ch=A_us_Man*(w_ca_Man_ch_f/price_deflator_ca)^kappa*phi_us_ca_ch^(-kappa)/us_options;

mig_us_Oth_ca_ca=A_us_Oth*(w_ca_Oth_ca_f/price_deflator_ca)^kappa*phi_us_ca_ca^(-kappa)/us_options;

mig_us_Fin_ca_us=A_us_Fin*(w_ca_Fin_us_s/price_deflator_ca)^kappa*phi_us_ca_us^(-kappa)/us_options;
mig_us_Fin_ca_in=A_us_Fin*(w_ca_Fin_in_f/price_deflator_ca)^kappa*phi_us_ca_in^(-kappa)/us_options;
mig_us_Fin_ca_eu=A_us_Fin*(w_ca_Fin_eu_f/price_deflator_ca)^kappa*phi_us_ca_eu^(-kappa)/us_options;
mig_us_Fin_ca_ca=A_us_Fin*(w_ca_Fin_ca_f/price_deflator_ca)^kappa*phi_us_ca_ca^(-kappa)/us_options;
mig_us_Fin_ca_ch=A_us_Fin*(w_ca_Fin_ch_f/price_deflator_ca)^kappa*phi_us_ca_ch^(-kappa)/us_options;


%Europe

eu_options=A_eu_IT*(w_us_IT_us_f/price_deflator_us)^kappa*phi_eu_us_us^(-kappa)*mig_eu(1,1)+A_eu_IT*(w_us_IT_in_f/price_deflator_us)^kappa*phi_eu_us_in^(-kappa)*mig_eu(1,2)...
    +A_eu_IT*(w_us_IT_eu_s/price_deflator_us)^kappa*phi_eu_us_eu^(-kappa)*mig_eu(1,3)+A_eu_IT*(w_us_IT_ca_f/price_deflator_us)^kappa*phi_eu_us_ca^(-kappa)*mig_eu(1,4)...
    +A_eu_IT*(w_us_IT_ch_f/price_deflator_us)^kappa*phi_eu_us_ch^(-kappa)*mig_eu(1,5)+A_eu_Man*(w_us_Man_us_f/price_deflator_us)^kappa*phi_eu_us_us^(-kappa)*mig_eu(1,6)...
    +A_eu_Man*(w_us_Man_in_f/price_deflator_us)^kappa*phi_eu_us_in^(-kappa)*mig_eu(1,7)+A_eu_Man*(w_us_Man_eu_s/price_deflator_us)^kappa*phi_eu_us_eu^(-kappa)*mig_eu(1,8)...
    +A_eu_Man*(w_us_Man_ca_f/price_deflator_us)^kappa*phi_eu_us_ca^(-kappa)*mig_eu(1,9)+A_eu_Man*(w_us_Man_ch_f/price_deflator_us)^kappa*phi_eu_us_ch^(-kappa)*mig_eu(1,10)...
    +A_eu_Oth*(w_us_Oth_us_f/price_deflator_us)^kappa*phi_eu_us_us^(-kappa)*mig_eu(1,11)...
    +A_eu_IT*(w_eu_IT_us_d/price_deflator_eu)^kappa*mig_eu(1,12)+A_eu_IT*(w_eu_IT_in_d/price_deflator_eu)^kappa*mig_eu(1,13)+A_eu_IT*(w_eu_IT_eu_d/price_deflator_eu)^kappa*mig_eu(1,14)...
    +A_eu_IT*(w_eu_IT_ca_d/price_deflator_eu)^kappa*mig_eu(1,15)+A_eu_IT*(w_eu_IT_ch_d/price_deflator_eu)^kappa*mig_eu(1,16)+A_eu_Man*(w_eu_Man_us_d/price_deflator_eu)^kappa*mig_eu(1,17)...
    +A_eu_Man*(w_eu_Man_in_d/price_deflator_eu)^kappa*mig_eu(1,18)+A_eu_Man*(w_eu_Man_eu_d/price_deflator_eu)^kappa*mig_eu(1,19)+A_eu_Man*(w_eu_Man_ca_d/price_deflator_eu)^kappa*mig_eu(1,20)...
    +A_eu_Man*(w_eu_Man_ch_d/price_deflator_eu)^kappa*mig_eu(1,21)+A_eu_Oth*(w_eu_Oth_eu_d/price_deflator_eu)^kappa*mig_eu(1,22)...
    +A_eu_IT*(w_ca_IT_us_f/price_deflator_ca)^kappa*phi_eu_ca_us^(-kappa)*mig_eu(1,23)...
    +A_eu_IT*(w_ca_IT_in_f/price_deflator_ca)^kappa*phi_eu_ca_in^(-kappa)*mig_eu(1,24)+A_eu_IT*(w_ca_IT_eu_s/price_deflator_ca)^kappa*phi_eu_ca_eu^(-kappa)*mig_eu(1,25)...
    +A_eu_IT*(w_ca_IT_ca_f/price_deflator_ca)^kappa*phi_eu_ca_ca^(-kappa)*mig_eu(1,26)+A_eu_IT*(w_ca_IT_ch_f/price_deflator_ca)^kappa*phi_eu_ca_ch^(-kappa)*mig_eu(1,27)...
    +A_eu_Man*(w_ca_Man_us_f/price_deflator_ca)^kappa*phi_eu_ca_us^(-kappa)*mig_eu(1,28)+A_eu_Man*(w_ca_Man_in_f/price_deflator_ca)^kappa*phi_eu_ca_in^(-kappa)*mig_eu(1,29)...
    +A_eu_Man*(w_ca_Man_eu_s/price_deflator_ca)^kappa*phi_eu_ca_eu^(-kappa)*mig_eu(1,30)+A_eu_Man*(w_ca_Man_ca_f/price_deflator_ca)^kappa*phi_eu_ca_ca^(-kappa)*mig_eu(1,31)...
    +A_eu_Man*(w_ca_Man_ch_f/price_deflator_ca)^kappa*phi_eu_ca_ch^(-kappa)*mig_eu(1,32)+A_eu_Oth*(w_ca_Oth_ca_f/price_deflator_ca)^kappa*phi_eu_ca_ca^(-kappa)*mig_eu(1,33)...
    +A_eu_Fin*(w_us_Fin_us_f/price_deflator_us)^kappa*phi_eu_us_us^(-kappa)*mig_eu(1,34)...
    +A_eu_Fin*(w_us_Fin_in_f/price_deflator_us)^kappa*phi_eu_us_in^(-kappa)*mig_eu(1,35)+A_eu_Fin*(w_us_Fin_eu_s/price_deflator_us)^kappa*phi_eu_us_eu^(-kappa)*mig_eu(1,36)...
    +A_eu_Fin*(w_us_Fin_ca_f/price_deflator_us)^kappa*phi_eu_us_ca^(-kappa)*mig_eu(1,37)+A_eu_Fin*(w_us_Fin_ch_f/price_deflator_us)^kappa*phi_eu_us_ch^(-kappa)*mig_eu(1,38)...
    +A_eu_Fin*(w_eu_Fin_us_d/price_deflator_eu)^kappa*mig_eu(1,39)...
    +A_eu_Fin*(w_eu_Fin_in_d/price_deflator_eu)^kappa*mig_eu(1,40)+A_eu_Fin*(w_eu_Fin_eu_d/price_deflator_eu)^kappa*mig_eu(1,41)+A_eu_Fin*(w_eu_Fin_ca_d/price_deflator_eu)^kappa*mig_eu(1,42)...
    +A_eu_Fin*(w_eu_Fin_ch_d/price_deflator_eu)^kappa*mig_eu(1,43)...
    +A_eu_Fin*(w_ca_Fin_us_f/price_deflator_ca)^kappa*phi_eu_ca_us^(-kappa)*mig_eu(1,44)+A_eu_Fin*(w_ca_Fin_in_f/price_deflator_ca)^kappa*phi_eu_ca_in^(-kappa)*mig_eu(1,45)...
    +A_eu_Fin*(w_ca_Fin_eu_s/price_deflator_ca)^kappa*phi_eu_ca_eu^(-kappa)*mig_eu(1,46)+A_eu_Fin*(w_ca_Fin_ca_f/price_deflator_ca)^kappa*phi_eu_ca_ca^(-kappa)*mig_eu(1,47)...
    +A_eu_Fin*(w_ca_Fin_ch_f/price_deflator_ca)^kappa*phi_eu_ca_ch^(-kappa)*mig_eu(1,48);



mig_eu_IT_us_us=A_eu_IT*(w_us_IT_us_f/price_deflator_us)^kappa*phi_eu_us_us^(-kappa)/eu_options;
mig_eu_IT_us_in=A_eu_IT*(w_us_IT_in_f/price_deflator_us)^kappa*phi_eu_us_in^(-kappa)/eu_options;
mig_eu_IT_us_eu=A_eu_IT*(w_us_IT_eu_s/price_deflator_us)^kappa*phi_eu_us_eu^(-kappa)/eu_options;
mig_eu_IT_us_ca=A_eu_IT*(w_us_IT_ca_f/price_deflator_us)^kappa*phi_eu_us_ca^(-kappa)/eu_options;
mig_eu_IT_us_ch=A_eu_IT*(w_us_IT_ch_f/price_deflator_us)^kappa*phi_eu_us_ch^(-kappa)/eu_options;

mig_eu_Man_us_us=A_eu_Man*(w_us_Man_us_f/price_deflator_us)^kappa*phi_eu_us_us^(-kappa)/eu_options;
mig_eu_Man_us_in=A_eu_Man*(w_us_Man_in_f/price_deflator_us)^kappa*phi_eu_us_in^(-kappa)/eu_options;
mig_eu_Man_us_eu=A_eu_Man*(w_us_Man_eu_s/price_deflator_us)^kappa*phi_eu_us_eu^(-kappa)/eu_options;
mig_eu_Man_us_ca=A_eu_Man*(w_us_Man_ca_f/price_deflator_us)^kappa*phi_eu_us_ca^(-kappa)/eu_options;
mig_eu_Man_us_ch=A_eu_Man*(w_us_Man_ch_f/price_deflator_us)^kappa*phi_eu_us_ch^(-kappa)/eu_options;

mig_eu_Oth_us_us=A_eu_Oth*(w_us_Oth_us_f/price_deflator_us)^kappa*phi_eu_us_us^(-kappa)/eu_options;

mig_eu_Fin_us_us=A_eu_Fin*(w_us_Fin_us_f/price_deflator_us)^kappa*phi_eu_us_us^(-kappa)/eu_options;
mig_eu_Fin_us_in=A_eu_Fin*(w_us_Fin_in_f/price_deflator_us)^kappa*phi_eu_us_in^(-kappa)/eu_options;
mig_eu_Fin_us_eu=A_eu_Fin*(w_us_Fin_eu_s/price_deflator_us)^kappa*phi_eu_us_eu^(-kappa)/eu_options;
mig_eu_Fin_us_ca=A_eu_Fin*(w_us_Fin_ca_f/price_deflator_us)^kappa*phi_eu_us_ca^(-kappa)/eu_options;
mig_eu_Fin_us_ch=A_eu_Fin*(w_us_Fin_ch_f/price_deflator_us)^kappa*phi_eu_us_ch^(-kappa)/eu_options;


mig_eu_IT_eu_us=A_eu_IT*(w_eu_IT_us_d/price_deflator_eu)^kappa/eu_options;
mig_eu_IT_eu_in=A_eu_IT*(w_eu_IT_in_d/price_deflator_eu)^kappa/eu_options;
mig_eu_IT_eu_eu=A_eu_IT*(w_eu_IT_eu_d/price_deflator_eu)^kappa/eu_options;
mig_eu_IT_eu_ca=A_eu_IT*(w_eu_IT_ca_d/price_deflator_eu)^kappa/eu_options;
mig_eu_IT_eu_ch=A_eu_IT*(w_eu_IT_ch_d/price_deflator_eu)^kappa/eu_options;

mig_eu_Man_eu_us=A_eu_Man*(w_eu_Man_us_d/price_deflator_eu)^kappa/eu_options;
mig_eu_Man_eu_in=A_eu_Man*(w_eu_Man_in_d/price_deflator_eu)^kappa/eu_options;
mig_eu_Man_eu_eu=A_eu_Man*(w_eu_Man_eu_d/price_deflator_eu)^kappa/eu_options;
mig_eu_Man_eu_ca=A_eu_Man*(w_eu_Man_ca_d/price_deflator_eu)^kappa/eu_options;
mig_eu_Man_eu_ch=A_eu_Man*(w_eu_Man_ch_d/price_deflator_eu)^kappa/eu_options;

mig_eu_Oth_eu_eu=A_eu_Oth*(w_eu_Oth_eu_d/price_deflator_eu)^kappa/eu_options;

mig_eu_Fin_eu_us=A_eu_Fin*(w_eu_Fin_us_d/price_deflator_eu)^kappa/eu_options;
mig_eu_Fin_eu_in=A_eu_Fin*(w_eu_Fin_in_d/price_deflator_eu)^kappa/eu_options;
mig_eu_Fin_eu_eu=A_eu_Fin*(w_eu_Fin_eu_d/price_deflator_eu)^kappa/eu_options;
mig_eu_Fin_eu_ca=A_eu_Fin*(w_eu_Fin_ca_d/price_deflator_eu)^kappa/eu_options;
mig_eu_Fin_eu_ch=A_eu_Fin*(w_eu_Fin_ch_d/price_deflator_eu)^kappa/eu_options;


mig_eu_IT_ca_us=A_eu_IT*(w_ca_IT_us_f/price_deflator_ca)^kappa*phi_eu_ca_us^(-kappa)/eu_options;
mig_eu_IT_ca_in=A_eu_IT*(w_ca_IT_in_f/price_deflator_ca)^kappa*phi_eu_ca_in^(-kappa)/eu_options;
mig_eu_IT_ca_eu=A_eu_IT*(w_ca_IT_eu_s/price_deflator_ca)^kappa*phi_eu_ca_eu^(-kappa)/eu_options;
mig_eu_IT_ca_ca=A_eu_IT*(w_ca_IT_ca_f/price_deflator_ca)^kappa*phi_eu_ca_ca^(-kappa)/eu_options;
mig_eu_IT_ca_ch=A_eu_IT*(w_ca_IT_ch_f/price_deflator_ca)^kappa*phi_eu_ca_ch^(-kappa)/eu_options;

mig_eu_Man_ca_us=A_eu_Man*(w_ca_Man_us_f/price_deflator_ca)^kappa*phi_eu_ca_us^(-kappa)/eu_options;
mig_eu_Man_ca_in=A_eu_Man*(w_ca_Man_in_f/price_deflator_ca)^kappa*phi_eu_ca_in^(-kappa)/eu_options;
mig_eu_Man_ca_eu=A_eu_Man*(w_ca_Man_eu_s/price_deflator_ca)^kappa*phi_eu_ca_eu^(-kappa)/eu_options;
mig_eu_Man_ca_ca=A_eu_Man*(w_ca_Man_ca_f/price_deflator_ca)^kappa*phi_eu_ca_ca^(-kappa)/eu_options;
mig_eu_Man_ca_ch=A_eu_Man*(w_ca_Man_ch_f/price_deflator_ca)^kappa*phi_eu_ca_ch^(-kappa)/eu_options;

mig_eu_Oth_ca_ca=A_eu_Oth*(w_ca_Oth_ca_f/price_deflator_ca)^kappa*phi_eu_ca_ca^(-kappa)/eu_options;

mig_eu_Fin_ca_us=A_eu_Fin*(w_ca_Fin_us_f/price_deflator_ca)^kappa*phi_eu_ca_us^(-kappa)/eu_options;
mig_eu_Fin_ca_in=A_eu_Fin*(w_ca_Fin_in_f/price_deflator_ca)^kappa*phi_eu_ca_in^(-kappa)/eu_options;
mig_eu_Fin_ca_eu=A_eu_Fin*(w_ca_Fin_eu_s/price_deflator_ca)^kappa*phi_eu_ca_eu^(-kappa)/eu_options;
mig_eu_Fin_ca_ca=A_eu_Fin*(w_ca_Fin_ca_f/price_deflator_ca)^kappa*phi_eu_ca_ca^(-kappa)/eu_options;
mig_eu_Fin_ca_ch=A_eu_Fin*(w_ca_Fin_ch_f/price_deflator_ca)^kappa*phi_eu_ca_ch^(-kappa)/eu_options;


%Canada


ca_options=A_ca_IT*(w_us_IT_us_f/price_deflator_us)^kappa*phi_ca_us_us^(-kappa)*mig_ca(1,1)+A_ca_IT*(w_us_IT_in_f/price_deflator_us)^kappa*phi_ca_us_in^(-kappa)*mig_ca(1,2)...
    +A_ca_IT*(w_us_IT_eu_f/price_deflator_us)^kappa*phi_ca_us_eu^(-kappa)*mig_ca(1,3)+A_ca_IT*(w_us_IT_ca_s/price_deflator_us)^kappa*phi_ca_us_ca^(-kappa)*mig_ca(1,4)...
    +A_ca_IT*(w_us_IT_ch_f/price_deflator_us)^kappa*phi_ca_us_ch^(-kappa)*mig_ca(1,5)+A_ca_Man*(w_us_Man_us_f/price_deflator_us)^kappa*phi_ca_us_us^(-kappa)*mig_ca(1,6)...
    +A_ca_Man*(w_us_Man_in_f/price_deflator_us)^kappa*phi_ca_us_in^(-kappa)*mig_ca(1,7)+A_ca_Man*(w_us_Man_eu_f/price_deflator_us)^kappa*phi_ca_us_eu^(-kappa)*mig_ca(1,8)...
    +A_ca_Man*(w_us_Man_ca_s/price_deflator_us)^kappa*phi_ca_us_ca^(-kappa)*mig_ca(1,9)+A_ca_Man*(w_us_Man_ch_f/price_deflator_us)^kappa*phi_ca_us_ch^(-kappa)*mig_ca(1,10)...
    +A_ca_Oth*(w_us_Oth_us_f/price_deflator_us)^kappa*phi_ca_us_us^(-kappa)*mig_ca(1,11)...    
    +A_ca_IT*(w_eu_IT_us_f/price_deflator_eu)^kappa*phi_ca_eu_us^(-kappa)*mig_ca(1,12)...
    +A_ca_IT*(w_eu_IT_in_f/price_deflator_eu)^kappa*phi_ca_eu_in^(-kappa)*mig_ca(1,13)+A_ca_IT*(w_eu_IT_eu_f/price_deflator_eu)^kappa*phi_ca_eu_eu^(-kappa)*mig_ca(1,14)...
    +A_ca_IT*(w_eu_IT_ca_s/price_deflator_eu)^kappa*phi_ca_eu_ca^(-kappa)*mig_ca(1,15)+A_ca_IT*(w_eu_IT_ch_f/price_deflator_eu)^kappa*phi_ca_eu_ch^(-kappa)*mig_ca(1,16)...
    +A_ca_Man*(w_eu_Man_us_f/price_deflator_eu)^kappa*phi_ca_eu_us^(-kappa)*mig_ca(1,17)+A_ca_Man*(w_eu_Man_in_f/price_deflator_eu)^kappa*phi_ca_eu_in^(-kappa)*mig_ca(1,18)...
    +A_ca_Man*(w_eu_Man_eu_f/price_deflator_eu)^kappa*phi_ca_eu_eu^(-kappa)*mig_ca(1,19)+A_ca_Man*(w_eu_Man_ca_s/price_deflator_eu)^kappa*phi_ca_eu_ca^(-kappa)*mig_ca(1,20)...
    +A_ca_Man*(w_eu_Man_ch_f/price_deflator_eu)^kappa*phi_ca_eu_ch^(-kappa)*mig_ca(1,21)+A_ca_Oth*(w_eu_Oth_eu_f/price_deflator_eu)^kappa*phi_ca_eu_eu^(-kappa)*mig_ca(1,22)...
    +A_ca_IT*(w_ca_IT_us_d/price_deflator_ca)^kappa*mig_ca(1,23)+A_ca_IT*(w_ca_IT_in_d/price_deflator_ca)^kappa*mig_ca(1,24)+A_ca_IT*(w_ca_IT_eu_d/price_deflator_ca)^kappa*mig_ca(1,25)...
    +A_ca_IT*(w_ca_IT_ca_d/price_deflator_ca)^kappa*mig_ca(1,26)+A_ca_IT*(w_ca_IT_ch_d/price_deflator_ca)^kappa*mig_ca(1,27)+A_ca_Man*(w_ca_Man_us_d/price_deflator_ca)^kappa*mig_ca(1,28)...
    +A_ca_Man*(w_ca_Man_in_d/price_deflator_ca)^kappa*mig_ca(1,29)+A_ca_Man*(w_ca_Man_eu_d/price_deflator_ca)^kappa*mig_ca(1,30)+A_ca_Man*(w_ca_Man_ca_d/price_deflator_ca)^kappa*mig_ca(1,31)...
    +A_ca_Man*(w_ca_Man_ch_d/price_deflator_ca)^kappa*mig_ca(1,32)+A_ca_Oth*(w_ca_Oth_ca_d/price_deflator_ca)^kappa*mig_ca(1,33)...
    +A_ca_Fin*(w_us_Fin_us_f/price_deflator_us)^kappa*phi_ca_us_us^(-kappa)*mig_ca(1,34)+A_ca_Fin*(w_us_Fin_in_f/price_deflator_us)^kappa*phi_ca_us_in^(-kappa)*mig_ca(1,35)...
    +A_ca_Fin*(w_us_Fin_eu_f/price_deflator_us)^kappa*phi_ca_us_eu^(-kappa)*mig_ca(1,36)...
    +A_ca_Fin*(w_us_Fin_ca_s/price_deflator_us)^kappa*phi_ca_us_ca^(-kappa)*mig_ca(1,37)+A_ca_Fin*(w_us_Fin_ch_f/price_deflator_us)^kappa*phi_ca_us_ch^(-kappa)*mig_ca(1,38)...
    +A_ca_Fin*(w_eu_Fin_us_f/price_deflator_eu)^kappa*phi_ca_eu_us^(-kappa)*mig_ca(1,39)+A_ca_Fin*(w_eu_Fin_in_f/price_deflator_eu)^kappa*phi_ca_eu_in^(-kappa)*mig_ca(1,40)...
    +A_ca_Fin*(w_eu_Fin_eu_f/price_deflator_eu)^kappa*phi_ca_eu_eu^(-kappa)*mig_ca(1,41)+A_ca_Fin*(w_eu_Fin_ca_s/price_deflator_eu)^kappa*phi_ca_eu_ca^(-kappa)*mig_ca(1,42)...
    +A_ca_Fin*(w_eu_Fin_ch_f/price_deflator_eu)^kappa*phi_ca_eu_ch^(-kappa)*mig_ca(1,43)...
    +A_ca_Fin*(w_ca_Fin_us_d/price_deflator_ca)^kappa*mig_ca(1,44)...
    +A_ca_Fin*(w_ca_Fin_in_d/price_deflator_ca)^kappa*mig_ca(1,45)+A_ca_Fin*(w_ca_Fin_eu_d/price_deflator_ca)^kappa*mig_ca(1,46)+A_ca_Fin*(w_ca_Fin_ca_d/price_deflator_ca)^kappa*mig_ca(1,47)...
    +A_ca_Fin*(w_ca_Fin_ch_d/price_deflator_ca)^kappa*mig_ca(1,48);




mig_ca_IT_us_us=A_ca_IT*(w_us_IT_us_f/price_deflator_us)^kappa*phi_ca_us_us^(-kappa)/ca_options;
mig_ca_IT_us_in=A_ca_IT*(w_us_IT_in_f/price_deflator_us)^kappa*phi_ca_us_in^(-kappa)/ca_options;
mig_ca_IT_us_eu=A_ca_IT*(w_us_IT_eu_f/price_deflator_us)^kappa*phi_ca_us_eu^(-kappa)/ca_options;
mig_ca_IT_us_ca=A_ca_IT*(w_us_IT_ca_s/price_deflator_us)^kappa*phi_ca_us_ca^(-kappa)/ca_options;
mig_ca_IT_us_ch=A_ca_IT*(w_us_IT_ch_f/price_deflator_us)^kappa*phi_ca_us_ch^(-kappa)/ca_options;

mig_ca_Man_us_us=A_ca_Man*(w_us_Man_us_f/price_deflator_us)^kappa*phi_ca_us_us^(-kappa)/ca_options;
mig_ca_Man_us_in=A_ca_Man*(w_us_Man_in_f/price_deflator_us)^kappa*phi_ca_us_in^(-kappa)/ca_options;
mig_ca_Man_us_eu=A_ca_Man*(w_us_Man_eu_f/price_deflator_us)^kappa*phi_ca_us_eu^(-kappa)/ca_options;
mig_ca_Man_us_ca=A_ca_Man*(w_us_Man_ca_s/price_deflator_us)^kappa*phi_ca_us_ca^(-kappa)/ca_options;
mig_ca_Man_us_ch=A_ca_Man*(w_us_Man_ch_f/price_deflator_us)^kappa*phi_ca_us_ch^(-kappa)/ca_options;

mig_ca_Oth_us_us=A_ca_Oth*(w_us_Oth_us_f/price_deflator_us)^kappa*phi_ca_us_us^(-kappa)/ca_options;

mig_ca_Fin_us_us=A_ca_Fin*(w_us_Fin_us_f/price_deflator_us)^kappa*phi_ca_us_us^(-kappa)/ca_options;
mig_ca_Fin_us_in=A_ca_Fin*(w_us_Fin_in_f/price_deflator_us)^kappa*phi_ca_us_in^(-kappa)/ca_options;
mig_ca_Fin_us_eu=A_ca_Fin*(w_us_Fin_eu_f/price_deflator_us)^kappa*phi_ca_us_eu^(-kappa)/ca_options;
mig_ca_Fin_us_ca=A_ca_Fin*(w_us_Fin_ca_s/price_deflator_us)^kappa*phi_ca_us_ca^(-kappa)/ca_options;
mig_ca_Fin_us_ch=A_ca_Fin*(w_us_Fin_ch_f/price_deflator_us)^kappa*phi_ca_us_ch^(-kappa)/ca_options;


mig_ca_IT_eu_us=A_ca_IT*(w_eu_IT_us_f/price_deflator_eu)^kappa*phi_ca_eu_us^(-kappa)/ca_options;
mig_ca_IT_eu_in=A_ca_IT*(w_eu_IT_in_f/price_deflator_eu)^kappa*phi_ca_eu_in^(-kappa)/ca_options;
mig_ca_IT_eu_eu=A_ca_IT*(w_eu_IT_eu_f/price_deflator_eu)^kappa*phi_ca_eu_eu^(-kappa)/ca_options;
mig_ca_IT_eu_ca=A_ca_IT*(w_eu_IT_ca_s/price_deflator_eu)^kappa*phi_ca_eu_ca^(-kappa)/ca_options;
mig_ca_IT_eu_ch=A_ca_IT*(w_eu_IT_ch_f/price_deflator_eu)^kappa*phi_ca_eu_ch^(-kappa)/ca_options;

mig_ca_Man_eu_us=A_ca_Man*(w_eu_Man_us_f/price_deflator_eu)^kappa*phi_ca_eu_us^(-kappa)/ca_options;
mig_ca_Man_eu_in=A_ca_Man*(w_eu_Man_in_f/price_deflator_eu)^kappa*phi_ca_eu_in^(-kappa)/ca_options;
mig_ca_Man_eu_eu=A_ca_Man*(w_eu_Man_eu_f/price_deflator_eu)^kappa*phi_ca_eu_eu^(-kappa)/ca_options;
mig_ca_Man_eu_ca=A_ca_Man*(w_eu_Man_ca_s/price_deflator_eu)^kappa*phi_ca_eu_ca^(-kappa)/ca_options;
mig_ca_Man_eu_ch=A_ca_Man*(w_eu_Man_ch_f/price_deflator_eu)^kappa*phi_ca_eu_ch^(-kappa)/ca_options;

mig_ca_Oth_eu_eu=A_ca_Oth*(w_eu_Oth_eu_f/price_deflator_eu)^kappa*phi_ca_eu_eu^(-kappa)/ca_options;

mig_ca_Fin_eu_us=A_ca_Fin*(w_eu_Fin_us_f/price_deflator_eu)^kappa*phi_ca_eu_us^(-kappa)/ca_options;
mig_ca_Fin_eu_in=A_ca_Fin*(w_eu_Fin_in_f/price_deflator_eu)^kappa*phi_ca_eu_in^(-kappa)/ca_options;
mig_ca_Fin_eu_eu=A_ca_Fin*(w_eu_Fin_eu_f/price_deflator_eu)^kappa*phi_ca_eu_eu^(-kappa)/ca_options;
mig_ca_Fin_eu_ca=A_ca_Fin*(w_eu_Fin_ca_s/price_deflator_eu)^kappa*phi_ca_eu_ca^(-kappa)/ca_options;
mig_ca_Fin_eu_ch=A_ca_Fin*(w_eu_Fin_ch_f/price_deflator_eu)^kappa*phi_ca_eu_ch^(-kappa)/ca_options;


mig_ca_IT_ca_us=A_ca_IT*(w_ca_IT_us_d/price_deflator_ca)^kappa/ca_options;
mig_ca_IT_ca_in=A_ca_IT*(w_ca_IT_in_d/price_deflator_ca)^kappa/ca_options;
mig_ca_IT_ca_eu=A_ca_IT*(w_ca_IT_eu_d/price_deflator_ca)^kappa/ca_options;
mig_ca_IT_ca_ca=A_ca_IT*(w_ca_IT_ca_d/price_deflator_ca)^kappa/ca_options;
mig_ca_IT_ca_ch=A_ca_IT*(w_ca_IT_ch_d/price_deflator_ca)^kappa/ca_options;

mig_ca_Man_ca_us=A_ca_Man*(w_ca_Man_us_d/price_deflator_ca)^kappa/ca_options;
mig_ca_Man_ca_in=A_ca_Man*(w_ca_Man_in_d/price_deflator_ca)^kappa/ca_options;
mig_ca_Man_ca_eu=A_ca_Man*(w_ca_Man_eu_d/price_deflator_ca)^kappa/ca_options;
mig_ca_Man_ca_ca=A_ca_Man*(w_ca_Man_ca_d/price_deflator_ca)^kappa/ca_options;
mig_ca_Man_ca_ch=A_ca_Man*(w_ca_Man_ch_d/price_deflator_ca)^kappa/ca_options;

mig_ca_Oth_ca_ca=A_ca_Oth*(w_ca_Oth_ca_d/price_deflator_ca)^kappa/ca_options;

mig_ca_Fin_ca_us=A_ca_Fin*(w_ca_Fin_us_d/price_deflator_ca)^kappa/ca_options;
mig_ca_Fin_ca_in=A_ca_Fin*(w_ca_Fin_in_d/price_deflator_ca)^kappa/ca_options;
mig_ca_Fin_ca_eu=A_ca_Fin*(w_ca_Fin_eu_d/price_deflator_ca)^kappa/ca_options;
mig_ca_Fin_ca_ca=A_ca_Fin*(w_ca_Fin_ca_d/price_deflator_ca)^kappa/ca_options;
mig_ca_Fin_ca_ch=A_ca_Fin*(w_ca_Fin_ch_d/price_deflator_ca)^kappa/ca_options;

%India


in_options=A_in_IT*(w_us_IT_us_f/price_deflator_us)^kappa*phi_in_us_us^(-kappa)*mig_in(1,1)+A_in_IT*(w_us_IT_in_s/price_deflator_us)^kappa*phi_in_us_in^(-kappa)*mig_in(1,2)...
    +A_in_IT*(w_us_IT_eu_f/price_deflator_us)^kappa*phi_in_us_eu^(-kappa)*mig_in(1,3)+A_in_IT*(w_us_IT_ca_f/price_deflator_us)^kappa*phi_in_us_ca^(-kappa)*mig_in(1,4)...
    +A_in_IT*(w_us_IT_ch_f/price_deflator_us)^kappa*phi_in_us_ch^(-kappa)*mig_in(1,5)+A_in_Man*(w_us_Man_us_f/price_deflator_us)^kappa*phi_in_us_us^(-kappa)*mig_in(1,6)...
    +A_in_Man*(w_us_Man_in_s/price_deflator_us)^kappa*phi_in_us_in^(-kappa)*mig_in(1,7)+A_in_Man*(w_us_Man_eu_f/price_deflator_us)^kappa*phi_in_us_eu^(-kappa)*mig_in(1,8)...
    +A_in_Man*(w_us_Man_ca_f/price_deflator_us)^kappa*phi_in_us_ca^(-kappa)*mig_in(1,9)+A_in_Man*(w_us_Man_ch_f/price_deflator_us)^kappa*phi_in_us_ch^(-kappa)*mig_in(1,10)...
    +A_in_Oth*(w_us_Oth_us_f/price_deflator_us)^kappa*phi_in_us_us^(-kappa)*mig_in(1,11)...    
    +A_in_IT*(w_eu_IT_us_f/price_deflator_eu)^kappa*phi_in_eu_us^(-kappa)*mig_in(1,12)...
    +A_in_IT*(w_eu_IT_in_s/price_deflator_eu)^kappa*phi_in_eu_in^(-kappa)*mig_in(1,13)+A_in_IT*(w_eu_IT_eu_f/price_deflator_eu)^kappa*phi_in_eu_eu^(-kappa)*mig_in(1,14)...
    +A_in_IT*(w_eu_IT_ca_f/price_deflator_eu)^kappa*phi_in_eu_ca^(-kappa)*mig_in(1,15)+A_in_IT*(w_eu_IT_ch_f/price_deflator_eu)^kappa*phi_in_eu_ch^(-kappa)*mig_in(1,16)...
    +A_in_Man*(w_eu_Man_us_f/price_deflator_eu)^kappa*phi_in_eu_us^(-kappa)*mig_in(1,17)+A_in_Man*(w_eu_Man_in_s/price_deflator_eu)^kappa*phi_in_eu_in^(-kappa)*mig_in(1,18)...
    +A_in_Man*(w_eu_Man_eu_f/price_deflator_eu)^kappa*phi_in_eu_eu^(-kappa)*mig_in(1,19)+A_in_Man*(w_eu_Man_ca_f/price_deflator_eu)^kappa*phi_in_eu_ca^(-kappa)*mig_in(1,20)...
    +A_in_Man*(w_eu_Man_ch_f/price_deflator_eu)^kappa*phi_in_eu_ch^(-kappa)*mig_in(1,21)+A_in_Oth*(w_eu_Oth_eu_f/price_deflator_eu)^kappa*phi_in_eu_eu^(-kappa)*mig_in(1,22)...
    +A_in_IT*(w_ca_IT_us_f/price_deflator_ca)^kappa*phi_in_ca_us^(-kappa)*mig_in(1,23)...
    +A_in_IT*(w_ca_IT_in_s/price_deflator_ca)^kappa*phi_in_ca_in^(-kappa)*mig_in(1,24)+A_in_IT*(w_ca_IT_eu_f/price_deflator_ca)^kappa*phi_in_ca_eu^(-kappa)*mig_in(1,25)...
    +A_in_IT*(w_ca_IT_ca_f/price_deflator_ca)^kappa*phi_in_ca_ca^(-kappa)*mig_in(1,26)+A_in_IT*(w_ca_IT_ch_f/price_deflator_ca)^kappa*phi_in_ca_ch^(-kappa)*mig_in(1,27)...
    +A_in_Man*(w_ca_Man_us_f/price_deflator_ca)^kappa*phi_in_ca_us^(-kappa)*mig_in(1,28)+A_in_Man*(w_ca_Man_in_s/price_deflator_ca)^kappa*phi_in_ca_in^(-kappa)*mig_in(1,29)...
    +A_in_Man*(w_ca_Man_eu_f/price_deflator_ca)^kappa*phi_in_ca_eu^(-kappa)*mig_in(1,30)+A_in_Man*(w_ca_Man_ca_f/price_deflator_ca)^kappa*phi_in_ca_ca^(-kappa)*mig_in(1,31)...
    +A_in_Man*(w_ca_Man_ch_f/price_deflator_ca)^kappa*phi_in_ca_ch^(-kappa)*mig_in(1,32)+A_in_Oth*(w_ca_Oth_ca_f/price_deflator_ca)^kappa*phi_in_ca_ca^(-kappa)*mig_in(1,33)...
    +A_in_IT*(w_in_IT_us/price_deflator_in)^kappa*mig_in(1,34)+A_in_IT*(w_in_IT_in/price_deflator_in)^kappa*mig_in(1,35)+A_in_IT*(w_in_IT_eu/price_deflator_in)^kappa*mig_in(1,36)+A_in_IT*(w_in_IT_ca/price_deflator_in)^kappa*mig_in(1,37)...
    +A_in_IT*(w_in_IT_ch/price_deflator_in)^kappa*mig_in(1,38)+A_in_Man*(w_in_Man_us/price_deflator_in)^kappa*mig_in(1,39)+A_in_Man*(w_in_Man_in/price_deflator_in)^kappa*mig_in(1,40)+A_in_Man*(w_in_Man_eu/price_deflator_in)^kappa*mig_in(1,41)...
    +A_in_Man*(w_in_Man_ca/price_deflator_in)^kappa*mig_in(1,42)+A_in_Man*(w_in_Man_ch/price_deflator_in)^kappa*mig_in(1,43)+A_in_Oth*(w_in_Oth_in/price_deflator_in)^kappa*mig_in(1,44)...
    +A_in_Fin*(w_us_Fin_us_f/price_deflator_us)^kappa*phi_in_us_us^(-kappa)*mig_in(1,45)...
    +A_in_Fin*(w_us_Fin_in_s/price_deflator_us)^kappa*phi_in_us_in^(-kappa)*mig_in(1,46)+A_in_Fin*(w_us_Fin_eu_f/price_deflator_us)^kappa*phi_in_us_eu^(-kappa)*mig_in(1,47)...
    +A_in_Fin*(w_us_Fin_ca_f/price_deflator_us)^kappa*phi_in_us_ca^(-kappa)*mig_in(1,48)+A_in_Fin*(w_us_Fin_ch_f/price_deflator_us)^kappa*phi_in_us_ch^(-kappa)*mig_in(1,49)...
    +A_in_Fin*(w_eu_Fin_us_f/price_deflator_eu)^kappa*phi_in_eu_us^(-kappa)*mig_in(1,50)+A_in_Fin*(w_eu_Fin_in_s/price_deflator_eu)^kappa*phi_in_eu_in^(-kappa)*mig_in(1,51)...
    +A_in_Fin*(w_eu_Fin_eu_f/price_deflator_eu)^kappa*phi_in_eu_eu^(-kappa)*mig_in(1,52)+A_in_Fin*(w_eu_Fin_ca_f/price_deflator_eu)^kappa*phi_in_eu_ca^(-kappa)*mig_in(1,53)...
    +A_in_Fin*(w_eu_Fin_ch_f/price_deflator_eu)^kappa*phi_in_eu_ch^(-kappa)*mig_in(1,54)...
    +A_in_Fin*(w_ca_Fin_us_f/price_deflator_ca)^kappa*phi_in_ca_us^(-kappa)*mig_in(1,55)+A_in_Fin*(w_ca_Fin_in_s/price_deflator_ca)^kappa*phi_in_ca_in^(-kappa)*mig_in(1,56)...
    +A_in_Fin*(w_ca_Fin_eu_f/price_deflator_ca)^kappa*phi_in_ca_eu^(-kappa)*mig_in(1,57)+A_in_Fin*(w_ca_Fin_ca_f/price_deflator_ca)^kappa*phi_in_ca_ca^(-kappa)*mig_in(1,58)...
    +A_in_Fin*(w_ca_Fin_ch_f/price_deflator_ca)^kappa*phi_in_ca_ch^(-kappa)*mig_in(1,59)...
    +A_in_Fin*(w_in_Fin_us/price_deflator_in)^kappa*mig_in(1,60)+A_in_Fin*(w_in_Fin_in/price_deflator_in)^kappa*mig_in(1,61)+A_in_Fin*(w_in_Fin_eu/price_deflator_in)^kappa*mig_in(1,62)...
    +A_in_Fin*(w_in_Fin_ca/price_deflator_in)^kappa*mig_in(1,63)+A_in_Fin*(w_in_Fin_ch/price_deflator_in)^kappa*mig_in(1,64);


mig_in_IT_us_us=A_in_IT*(w_us_IT_us_f/price_deflator_us)^kappa*phi_in_us_us^(-kappa)/in_options;
mig_in_IT_us_in=A_in_IT*(w_us_IT_in_s/price_deflator_us)^kappa*phi_in_us_in^(-kappa)/in_options;
mig_in_IT_us_eu=A_in_IT*(w_us_IT_eu_f/price_deflator_us)^kappa*phi_in_us_eu^(-kappa)/in_options;
mig_in_IT_us_ca=A_in_IT*(w_us_IT_ca_f/price_deflator_us)^kappa*phi_in_us_ca^(-kappa)/in_options;
mig_in_IT_us_ch=A_in_IT*(w_us_IT_ch_f/price_deflator_us)^kappa*phi_in_us_ch^(-kappa)/in_options;

mig_in_Man_us_us=A_in_Man*(w_us_Man_us_f/price_deflator_us)^kappa*phi_in_us_us^(-kappa)/in_options;
mig_in_Man_us_in=A_in_Man*(w_us_Man_in_s/price_deflator_us)^kappa*phi_in_us_in^(-kappa)/in_options;
mig_in_Man_us_eu=A_in_Man*(w_us_Man_eu_f/price_deflator_us)^kappa*phi_in_us_eu^(-kappa)/in_options;
mig_in_Man_us_ca=A_in_Man*(w_us_Man_ca_f/price_deflator_us)^kappa*phi_in_us_ca^(-kappa)/in_options;
mig_in_Man_us_ch=A_in_Man*(w_us_Man_ch_f/price_deflator_us)^kappa*phi_in_us_ch^(-kappa)/in_options;

mig_in_Oth_us_us=A_in_Oth*(w_us_Oth_us_f/price_deflator_us)^kappa*phi_in_us_us^(-kappa)/in_options;


mig_in_Fin_us_us=A_in_Fin*(w_us_Fin_us_f/price_deflator_us)^kappa*phi_in_us_us^(-kappa)/in_options;
mig_in_Fin_us_in=A_in_Fin*(w_us_Fin_in_s/price_deflator_us)^kappa*phi_in_us_in^(-kappa)/in_options;
mig_in_Fin_us_eu=A_in_Fin*(w_us_Fin_eu_f/price_deflator_us)^kappa*phi_in_us_eu^(-kappa)/in_options;
mig_in_Fin_us_ca=A_in_Fin*(w_us_Fin_ca_f/price_deflator_us)^kappa*phi_in_us_ca^(-kappa)/in_options;
mig_in_Fin_us_ch=A_in_Fin*(w_us_Fin_ch_f/price_deflator_us)^kappa*phi_in_us_ch^(-kappa)/in_options;


mig_in_IT_eu_us=A_in_IT*(w_eu_IT_us_f/price_deflator_eu)^kappa*phi_in_eu_us^(-kappa)/in_options;
mig_in_IT_eu_in=A_in_IT*(w_eu_IT_in_s/price_deflator_eu)^kappa*phi_in_eu_in^(-kappa)/in_options;
mig_in_IT_eu_eu=A_in_IT*(w_eu_IT_eu_f/price_deflator_eu)^kappa*phi_in_eu_eu^(-kappa)/in_options;
mig_in_IT_eu_ca=A_in_IT*(w_eu_IT_ca_f/price_deflator_eu)^kappa*phi_in_eu_ca^(-kappa)/in_options;
mig_in_IT_eu_ch=A_in_IT*(w_eu_IT_ch_f/price_deflator_eu)^kappa*phi_in_eu_ch^(-kappa)/in_options;

mig_in_Man_eu_us=A_in_Man*(w_eu_Man_us_f/price_deflator_eu)^kappa*phi_in_eu_us^(-kappa)/in_options;
mig_in_Man_eu_in=A_in_Man*(w_eu_Man_in_s/price_deflator_eu)^kappa*phi_in_eu_in^(-kappa)/in_options;
mig_in_Man_eu_eu=A_in_Man*(w_eu_Man_eu_f/price_deflator_eu)^kappa*phi_in_eu_eu^(-kappa)/in_options;
mig_in_Man_eu_ca=A_in_Man*(w_eu_Man_ca_f/price_deflator_eu)^kappa*phi_in_eu_ca^(-kappa)/in_options;
mig_in_Man_eu_ch=A_in_Man*(w_eu_Man_ch_f/price_deflator_eu)^kappa*phi_in_eu_ch^(-kappa)/in_options;

mig_in_Oth_eu_eu=A_in_Oth*(w_eu_Oth_eu_f/price_deflator_eu)^kappa*phi_in_eu_eu^(-kappa)/in_options;

mig_in_Fin_eu_us=A_in_Fin*(w_eu_Fin_us_f/price_deflator_eu)^kappa*phi_in_eu_us^(-kappa)/in_options;
mig_in_Fin_eu_in=A_in_Fin*(w_eu_Fin_in_s/price_deflator_eu)^kappa*phi_in_eu_in^(-kappa)/in_options;
mig_in_Fin_eu_eu=A_in_Fin*(w_eu_Fin_eu_f/price_deflator_eu)^kappa*phi_in_eu_eu^(-kappa)/in_options;
mig_in_Fin_eu_ca=A_in_Fin*(w_eu_Fin_ca_f/price_deflator_eu)^kappa*phi_in_eu_ca^(-kappa)/in_options;
mig_in_Fin_eu_ch=A_in_Fin*(w_eu_Fin_ch_f/price_deflator_eu)^kappa*phi_in_eu_ch^(-kappa)/in_options;



mig_in_IT_ca_us=A_in_IT*(w_ca_IT_us_f/price_deflator_ca)^kappa*phi_in_ca_us^(-kappa)/in_options;
mig_in_IT_ca_in=A_in_IT*(w_ca_IT_in_s/price_deflator_ca)^kappa*phi_in_ca_in^(-kappa)/in_options;
mig_in_IT_ca_eu=A_in_IT*(w_ca_IT_eu_f/price_deflator_ca)^kappa*phi_in_ca_eu^(-kappa)/in_options;
mig_in_IT_ca_ca=A_in_IT*(w_ca_IT_ca_f/price_deflator_ca)^kappa*phi_in_ca_ca^(-kappa)/in_options;
mig_in_IT_ca_ch=A_in_IT*(w_ca_IT_ch_f/price_deflator_ca)^kappa*phi_in_ca_ch^(-kappa)/in_options;

mig_in_Man_ca_us=A_in_Man*(w_ca_Man_us_f/price_deflator_ca)^kappa*phi_in_ca_us^(-kappa)/in_options;
mig_in_Man_ca_in=A_in_Man*(w_ca_Man_in_s/price_deflator_ca)^kappa*phi_in_ca_in^(-kappa)/in_options;
mig_in_Man_ca_eu=A_in_Man*(w_ca_Man_eu_f/price_deflator_ca)^kappa*phi_in_ca_eu^(-kappa)/in_options;
mig_in_Man_ca_ca=A_in_Man*(w_ca_Man_ca_f/price_deflator_ca)^kappa*phi_in_ca_ca^(-kappa)/in_options;
mig_in_Man_ca_ch=A_in_Man*(w_ca_Man_ch_f/price_deflator_ca)^kappa*phi_in_ca_ch^(-kappa)/in_options;

mig_in_Oth_ca_ca=A_in_Oth*(w_ca_Oth_ca_f/price_deflator_ca)^kappa*phi_in_ca_ca^(-kappa)/in_options;

mig_in_Fin_ca_us=A_in_Fin*(w_ca_Fin_us_f/price_deflator_ca)^kappa*phi_in_ca_us^(-kappa)/in_options;
mig_in_Fin_ca_in=A_in_Fin*(w_ca_Fin_in_s/price_deflator_ca)^kappa*phi_in_ca_in^(-kappa)/in_options;
mig_in_Fin_ca_eu=A_in_Fin*(w_ca_Fin_eu_f/price_deflator_ca)^kappa*phi_in_ca_eu^(-kappa)/in_options;
mig_in_Fin_ca_ca=A_in_Fin*(w_ca_Fin_ca_f/price_deflator_ca)^kappa*phi_in_ca_ca^(-kappa)/in_options;
mig_in_Fin_ca_ch=A_in_Fin*(w_ca_Fin_ch_f/price_deflator_ca)^kappa*phi_in_ca_ch^(-kappa)/in_options;



mig_in_IT_in_us=A_in_IT*(w_in_IT_us/price_deflator_in)^kappa/in_options;
mig_in_IT_in_in=A_in_IT*(w_in_IT_in/price_deflator_in)^kappa/in_options;
mig_in_IT_in_eu=A_in_IT*(w_in_IT_eu/price_deflator_in)^kappa/in_options;
mig_in_IT_in_ca=A_in_IT*(w_in_IT_ca/price_deflator_in)^kappa/in_options;
mig_in_IT_in_ch=A_in_IT*(w_in_IT_ch/price_deflator_in)^kappa/in_options;
mig_in_Man_in_us=A_in_Man*(w_in_Man_us/price_deflator_in)^kappa/in_options;
mig_in_Man_in_in=A_in_Man*(w_in_Man_in/price_deflator_in)^kappa/in_options;
mig_in_Man_in_eu=A_in_Man*(w_in_Man_eu/price_deflator_in)^kappa/in_options;
mig_in_Man_in_ca=A_in_Man*(w_in_Man_ca/price_deflator_in)^kappa/in_options;
mig_in_Man_in_ch=A_in_Man*(w_in_Man_ch/price_deflator_in)^kappa/in_options;
mig_in_Oth_in_in=A_in_Oth*(w_in_Oth_in/price_deflator_in)^kappa/in_options;

mig_in_Fin_in_us=A_in_Fin*(w_in_Fin_us/price_deflator_in)^kappa/in_options;
mig_in_Fin_in_in=A_in_Fin*(w_in_Fin_in/price_deflator_in)^kappa/in_options;
mig_in_Fin_in_eu=A_in_Fin*(w_in_Fin_eu/price_deflator_in)^kappa/in_options;
mig_in_Fin_in_ca=A_in_Fin*(w_in_Fin_ca/price_deflator_in)^kappa/in_options;
mig_in_Fin_in_ch=A_in_Fin*(w_in_Fin_ch/price_deflator_in)^kappa/in_options;


%China

ch_options=A_ch_IT*(w_us_IT_us_f/price_deflator_us)^kappa*phi_ch_us_us^(-kappa)*mig_ch(1,1)+A_ch_IT*(w_us_IT_in_f/price_deflator_us)^kappa*phi_ch_us_in^(-kappa)*mig_ch(1,2)...
    +A_ch_IT*(w_us_IT_eu_f/price_deflator_us)^kappa*phi_ch_us_eu^(-kappa)*mig_ch(1,3)+A_ch_IT*(w_us_IT_ca_f/price_deflator_us)^kappa*phi_ch_us_ca^(-kappa)*mig_ch(1,4)...
    +A_ch_IT*(w_us_IT_ch_s/price_deflator_us)^kappa*phi_ch_us_ch^(-kappa)*mig_ch(1,5)+A_ch_Man*(w_us_Man_us_f/price_deflator_us)^kappa*phi_ch_us_us^(-kappa)*mig_ch(1,6)...
    +A_ch_Man*(w_us_Man_in_f/price_deflator_us)^kappa*phi_ch_us_in^(-kappa)*mig_ch(1,7)+A_ch_Man*(w_us_Man_eu_f/price_deflator_us)^kappa*phi_ch_us_eu^(-kappa)*mig_ch(1,8)...
    +A_ch_Man*(w_us_Man_ca_f/price_deflator_us)^kappa*phi_ch_us_ca^(-kappa)*mig_ch(1,9)+A_ch_Man*(w_us_Man_ch_s/price_deflator_us)^kappa*phi_ch_us_ch^(-kappa)*mig_ch(1,10)...
    +A_ch_Oth*(w_us_Oth_us_f/price_deflator_us)^kappa*phi_ch_us_us^(-kappa)*mig_ch(1,11)...    
    +A_ch_IT*(w_eu_IT_us_f/price_deflator_eu)^kappa*phi_ch_eu_us^(-kappa)*mig_ch(1,12)...
    +A_ch_IT*(w_eu_IT_in_f/price_deflator_eu)^kappa*phi_ch_eu_in^(-kappa)*mig_ch(1,13)+A_ch_IT*(w_eu_IT_eu_f/price_deflator_eu)^kappa*phi_ch_eu_eu^(-kappa)*mig_ch(1,14)...
    +A_ch_IT*(w_eu_IT_ca_f/price_deflator_eu)^kappa*phi_ch_eu_ca^(-kappa)*mig_ch(1,15)+A_ch_IT*(w_eu_IT_ch_s/price_deflator_eu)^kappa*phi_ch_eu_ch^(-kappa)*mig_ch(1,16)...
    +A_ch_Man*(w_eu_Man_us_f/price_deflator_eu)^kappa*phi_ch_eu_us^(-kappa)*mig_ch(1,17)+A_ch_Man*(w_eu_Man_in_f/price_deflator_eu)^kappa*phi_ch_eu_in^(-kappa)*mig_ch(1,18)...
    +A_ch_Man*(w_eu_Man_eu_f/price_deflator_eu)^kappa*phi_ch_eu_eu^(-kappa)*mig_ch(1,19)+A_ch_Man*(w_eu_Man_ca_f/price_deflator_eu)^kappa*phi_ch_eu_ca^(-kappa)*mig_ch(1,20)...
    +A_ch_Man*(w_eu_Man_ch_s/price_deflator_eu)^kappa*phi_ch_eu_ch^(-kappa)*mig_ch(1,21)+A_ch_Oth*(w_eu_Oth_eu_f/price_deflator_eu)^kappa*phi_ch_eu_eu^(-kappa)*mig_ch(1,22)...
    +A_ch_IT*(w_ca_IT_us_f/price_deflator_ca)^kappa*phi_ch_ca_us^(-kappa)*mig_ch(1,23)...
    +A_ch_IT*(w_ca_IT_in_f/price_deflator_ca)^kappa*phi_ch_ca_in^(-kappa)*mig_ch(1,24)+A_ch_IT*(w_ca_IT_eu_f/price_deflator_ca)^kappa*phi_ch_ca_eu^(-kappa)*mig_ch(1,25)...
    +A_ch_IT*(w_ca_IT_ca_f/price_deflator_ca)^kappa*phi_ch_ca_ca^(-kappa)*mig_ch(1,26)+A_ch_IT*(w_ca_IT_ch_s/price_deflator_ca)^kappa*phi_ch_ca_ch^(-kappa)*mig_ch(1,27)...
    +A_ch_Man*(w_ca_Man_us_f/price_deflator_ca)^kappa*phi_ch_ca_us^(-kappa)*mig_ch(1,28)+A_ch_Man*(w_ca_Man_in_f/price_deflator_ca)^kappa*phi_ch_ca_in^(-kappa)*mig_ch(1,29)...
    +A_ch_Man*(w_ca_Man_eu_f/price_deflator_ca)^kappa*phi_ch_ca_eu^(-kappa)*mig_ch(1,30)+A_ch_Man*(w_ca_Man_ca_f/price_deflator_ca)^kappa*phi_ch_ca_ca^(-kappa)*mig_ch(1,31)...
    +A_ch_Man*(w_ca_Man_ch_s/price_deflator_ca)^kappa*phi_ch_ca_ch^(-kappa)*mig_ch(1,32)+A_ch_Oth*(w_ca_Oth_ca_f/price_deflator_ca)^kappa*phi_ch_ca_ca^(-kappa)*mig_ch(1,33)...
    +A_ch_IT*(w_ch_IT_us/price_deflator_ch)^kappa*mig_ch(1,34)+A_ch_IT*(w_ch_IT_in/price_deflator_ch)^kappa*mig_ch(1,35)+A_ch_IT*(w_ch_IT_eu/price_deflator_ch)^kappa*mig_ch(1,36)+A_ch_IT*(w_ch_IT_ca/price_deflator_ch)^kappa*mig_ch(1,37)...
    +A_ch_IT*(w_ch_IT_ch/price_deflator_ch)^kappa*mig_ch(1,38)+A_ch_Man*(w_ch_Man_us/price_deflator_ch)^kappa*mig_ch(1,39)+A_ch_Man*(w_ch_Man_in/price_deflator_ch)^kappa*mig_ch(1,40)+A_ch_Man*(w_ch_Man_eu/price_deflator_ch)^kappa*mig_ch(1,41)...
    +A_ch_Man*(w_ch_Man_ca/price_deflator_ch)^kappa*mig_ch(1,42)+A_ch_Man*(w_ch_Man_ch/price_deflator_ch)^kappa*mig_ch(1,43)+A_ch_Oth*(w_ch_Oth_ch/price_deflator_ch)^kappa*mig_ch(1,44)...
    +A_ch_Fin*(w_us_Fin_us_f/price_deflator_us)^kappa*phi_ch_us_us^(-kappa)*mig_ch(1,45)...
    +A_ch_Fin*(w_us_Fin_in_f/price_deflator_us)^kappa*phi_ch_us_in^(-kappa)*mig_ch(1,46)+A_ch_Fin*(w_us_Fin_eu_f/price_deflator_us)^kappa*phi_ch_us_eu^(-kappa)*mig_ch(1,47)...
    +A_ch_Fin*(w_us_Fin_ca_f/price_deflator_us)^kappa*phi_ch_us_ca^(-kappa)*mig_ch(1,48)+A_ch_Fin*(w_us_Fin_ch_s/price_deflator_us)^kappa*phi_ch_us_ch^(-kappa)*mig_ch(1,49)...
    +A_ch_Fin*(w_eu_Fin_us_f/price_deflator_eu)^kappa*phi_ch_eu_us^(-kappa)*mig_ch(1,50)+A_ch_Fin*(w_eu_Fin_in_f/price_deflator_eu)^kappa*phi_ch_eu_in^(-kappa)*mig_ch(1,51)...
    +A_ch_Fin*(w_eu_Fin_eu_f/price_deflator_eu)^kappa*phi_ch_eu_eu^(-kappa)*mig_ch(1,52)+A_ch_Fin*(w_eu_Fin_ca_f/price_deflator_eu)^kappa*phi_ch_eu_ca^(-kappa)*mig_ch(1,53)...
    +A_ch_Fin*(w_eu_Fin_ch_s/price_deflator_eu)^kappa*phi_ch_eu_ch^(-kappa)*mig_ch(1,54)...
    +A_ch_Fin*(w_ca_Fin_us_f/price_deflator_ca)^kappa*phi_ch_ca_us^(-kappa)*mig_ch(1,55)+A_ch_Fin*(w_ca_Fin_in_f/price_deflator_ca)^kappa*phi_ch_ca_in^(-kappa)*mig_ch(1,56)...
    +A_ch_Fin*(w_ca_Fin_eu_f/price_deflator_ca)^kappa*phi_ch_ca_eu^(-kappa)*mig_ch(1,57)+A_ch_Fin*(w_ca_Fin_ca_f/price_deflator_ca)^kappa*phi_ch_ca_ca^(-kappa)*mig_ch(1,58)...
    +A_ch_Fin*(w_ca_Fin_ch_s/price_deflator_ca)^kappa*phi_ch_ca_ch^(-kappa)*mig_ch(1,59)...
    +A_ch_Fin*(w_ch_Fin_us/price_deflator_ch)^kappa*mig_ch(1,60)+A_ch_Fin*(w_ch_Fin_in/price_deflator_ch)^kappa*mig_ch(1,61)+A_ch_Fin*(w_ch_Fin_eu/price_deflator_ch)^kappa*mig_ch(1,62)...
    +A_ch_Fin*(w_ch_Fin_ca/price_deflator_ch)^kappa*mig_ch(1,63)+A_ch_Fin*(w_ch_Fin_ch/price_deflator_ch)^kappa*mig_ch(1,64);


mig_ch_IT_us_us=A_ch_IT*(w_us_IT_us_f/price_deflator_us)^kappa*phi_ch_us_us^(-kappa)/ch_options;
mig_ch_IT_us_in=A_ch_IT*(w_us_IT_in_f/price_deflator_us)^kappa*phi_ch_us_in^(-kappa)/ch_options;
mig_ch_IT_us_eu=A_ch_IT*(w_us_IT_eu_f/price_deflator_us)^kappa*phi_ch_us_eu^(-kappa)/ch_options;
mig_ch_IT_us_ca=A_ch_IT*(w_us_IT_ca_f/price_deflator_us)^kappa*phi_ch_us_ca^(-kappa)/ch_options;
mig_ch_IT_us_ch=A_ch_IT*(w_us_IT_ch_s/price_deflator_us)^kappa*phi_ch_us_ch^(-kappa)/ch_options;

mig_ch_Man_us_us=A_ch_Man*(w_us_Man_us_f/price_deflator_us)^kappa*phi_ch_us_us^(-kappa)/ch_options;
mig_ch_Man_us_in=A_ch_Man*(w_us_Man_in_f/price_deflator_us)^kappa*phi_ch_us_in^(-kappa)/ch_options;
mig_ch_Man_us_eu=A_ch_Man*(w_us_Man_eu_f/price_deflator_us)^kappa*phi_ch_us_eu^(-kappa)/ch_options;
mig_ch_Man_us_ca=A_ch_Man*(w_us_Man_ca_f/price_deflator_us)^kappa*phi_ch_us_ca^(-kappa)/ch_options;
mig_ch_Man_us_ch=A_ch_Man*(w_us_Man_ch_s/price_deflator_us)^kappa*phi_ch_us_ch^(-kappa)/ch_options;

mig_ch_Oth_us_us=A_ch_Oth*(w_us_Oth_us_f/price_deflator_us)^kappa*phi_ch_us_us^(-kappa)/ch_options;

mig_ch_Fin_us_us=A_ch_Fin*(w_us_Fin_us_f/price_deflator_us)^kappa*phi_ch_us_us^(-kappa)/ch_options;
mig_ch_Fin_us_in=A_ch_Fin*(w_us_Fin_in_f/price_deflator_us)^kappa*phi_ch_us_in^(-kappa)/ch_options;
mig_ch_Fin_us_eu=A_ch_Fin*(w_us_Fin_eu_f/price_deflator_us)^kappa*phi_ch_us_eu^(-kappa)/ch_options;
mig_ch_Fin_us_ca=A_ch_Fin*(w_us_Fin_ca_f/price_deflator_us)^kappa*phi_ch_us_ca^(-kappa)/ch_options;
mig_ch_Fin_us_ch=A_ch_Fin*(w_us_Fin_ch_s/price_deflator_us)^kappa*phi_ch_us_ch^(-kappa)/ch_options;


mig_ch_IT_eu_us=A_ch_IT*(w_eu_IT_us_f/price_deflator_eu)^kappa*phi_ch_eu_us^(-kappa)/ch_options;
mig_ch_IT_eu_in=A_ch_IT*(w_eu_IT_in_f/price_deflator_eu)^kappa*phi_ch_eu_in^(-kappa)/ch_options;
mig_ch_IT_eu_eu=A_ch_IT*(w_eu_IT_eu_f/price_deflator_eu)^kappa*phi_ch_eu_eu^(-kappa)/ch_options;
mig_ch_IT_eu_ca=A_ch_IT*(w_eu_IT_ca_f/price_deflator_eu)^kappa*phi_ch_eu_ca^(-kappa)/ch_options;
mig_ch_IT_eu_ch=A_ch_IT*(w_eu_IT_ch_s/price_deflator_eu)^kappa*phi_ch_eu_ch^(-kappa)/ch_options;

mig_ch_Man_eu_us=A_ch_Man*(w_eu_Man_us_f/price_deflator_eu)^kappa*phi_ch_eu_us^(-kappa)/ch_options;
mig_ch_Man_eu_in=A_ch_Man*(w_eu_Man_in_f/price_deflator_eu)^kappa*phi_ch_eu_in^(-kappa)/ch_options;
mig_ch_Man_eu_eu=A_ch_Man*(w_eu_Man_eu_f/price_deflator_eu)^kappa*phi_ch_eu_eu^(-kappa)/ch_options;
mig_ch_Man_eu_ca=A_ch_Man*(w_eu_Man_ca_f/price_deflator_eu)^kappa*phi_ch_eu_ca^(-kappa)/ch_options;
mig_ch_Man_eu_ch=A_ch_Man*(w_eu_Man_ch_s/price_deflator_eu)^kappa*phi_ch_eu_ch^(-kappa)/ch_options;

mig_ch_Oth_eu_eu=A_ch_Oth*(w_eu_Oth_eu_f/price_deflator_eu)^kappa*phi_ch_eu_eu^(-kappa)/ch_options;

mig_ch_Fin_eu_us=A_ch_Fin*(w_eu_Fin_us_f/price_deflator_eu)^kappa*phi_ch_eu_us^(-kappa)/ch_options;
mig_ch_Fin_eu_in=A_ch_Fin*(w_eu_Fin_in_f/price_deflator_eu)^kappa*phi_ch_eu_in^(-kappa)/ch_options;
mig_ch_Fin_eu_eu=A_ch_Fin*(w_eu_Fin_eu_f/price_deflator_eu)^kappa*phi_ch_eu_eu^(-kappa)/ch_options;
mig_ch_Fin_eu_ca=A_ch_Fin*(w_eu_Fin_ca_f/price_deflator_eu)^kappa*phi_ch_eu_ca^(-kappa)/ch_options;
mig_ch_Fin_eu_ch=A_ch_Fin*(w_eu_Fin_ch_s/price_deflator_eu)^kappa*phi_ch_eu_ch^(-kappa)/ch_options;


mig_ch_IT_ca_us=A_ch_IT*(w_ca_IT_us_f/price_deflator_ca)^kappa*phi_ch_ca_us^(-kappa)/ch_options;
mig_ch_IT_ca_in=A_ch_IT*(w_ca_IT_in_f/price_deflator_ca)^kappa*phi_ch_ca_in^(-kappa)/ch_options;
mig_ch_IT_ca_eu=A_ch_IT*(w_ca_IT_eu_f/price_deflator_ca)^kappa*phi_ch_ca_eu^(-kappa)/ch_options;
mig_ch_IT_ca_ca=A_ch_IT*(w_ca_IT_ca_f/price_deflator_ca)^kappa*phi_ch_ca_ca^(-kappa)/ch_options;
mig_ch_IT_ca_ch=A_ch_IT*(w_ca_IT_ch_s/price_deflator_ca)^kappa*phi_ch_ca_ch^(-kappa)/ch_options;

mig_ch_Man_ca_us=A_ch_Man*(w_ca_Man_us_f/price_deflator_ca)^kappa*phi_ch_ca_us^(-kappa)/ch_options;
mig_ch_Man_ca_in=A_ch_Man*(w_ca_Man_in_f/price_deflator_ca)^kappa*phi_ch_ca_in^(-kappa)/ch_options;
mig_ch_Man_ca_eu=A_ch_Man*(w_ca_Man_eu_f/price_deflator_ca)^kappa*phi_ch_ca_eu^(-kappa)/ch_options;
mig_ch_Man_ca_ca=A_ch_Man*(w_ca_Man_ca_f/price_deflator_ca)^kappa*phi_ch_ca_ca^(-kappa)/ch_options;
mig_ch_Man_ca_ch=A_ch_Man*(w_ca_Man_ch_s/price_deflator_ca)^kappa*phi_ch_ca_ch^(-kappa)/ch_options;

mig_ch_Oth_ca_ca=A_ch_Oth*(w_ca_Oth_ca_f/price_deflator_ca)^kappa*phi_ch_ca_ca^(-kappa)/ch_options;

mig_ch_Fin_ca_us=A_ch_Fin*(w_ca_Fin_us_f/price_deflator_ca)^kappa*phi_ch_ca_us^(-kappa)/ch_options;
mig_ch_Fin_ca_in=A_ch_Fin*(w_ca_Fin_in_f/price_deflator_ca)^kappa*phi_ch_ca_in^(-kappa)/ch_options;
mig_ch_Fin_ca_eu=A_ch_Fin*(w_ca_Fin_eu_f/price_deflator_ca)^kappa*phi_ch_ca_eu^(-kappa)/ch_options;
mig_ch_Fin_ca_ca=A_ch_Fin*(w_ca_Fin_ca_f/price_deflator_ca)^kappa*phi_ch_ca_ca^(-kappa)/ch_options;
mig_ch_Fin_ca_ch=A_ch_Fin*(w_ca_Fin_ch_s/price_deflator_ca)^kappa*phi_ch_ca_ch^(-kappa)/ch_options;


mig_ch_IT_ch_us=A_ch_IT*(w_ch_IT_us/price_deflator_ch)^kappa/ch_options;
mig_ch_IT_ch_in=A_ch_IT*(w_ch_IT_in/price_deflator_ch)^kappa/ch_options;
mig_ch_IT_ch_eu=A_ch_IT*(w_ch_IT_eu/price_deflator_ch)^kappa/ch_options;
mig_ch_IT_ch_ca=A_ch_IT*(w_ch_IT_ca/price_deflator_ch)^kappa/ch_options;
mig_ch_IT_ch_ch=A_ch_IT*(w_ch_IT_ch/price_deflator_ch)^kappa/ch_options;
mig_ch_Man_ch_us=A_ch_Man*(w_ch_Man_us/price_deflator_ch)^kappa/ch_options;
mig_ch_Man_ch_in=A_ch_Man*(w_ch_Man_in/price_deflator_ch)^kappa/ch_options;
mig_ch_Man_ch_eu=A_ch_Man*(w_ch_Man_eu/price_deflator_ch)^kappa/ch_options;
mig_ch_Man_ch_ca=A_ch_Man*(w_ch_Man_ca/price_deflator_ch)^kappa/ch_options;
mig_ch_Man_ch_ch=A_ch_Man*(w_ch_Man_ch/price_deflator_ch)^kappa/ch_options;
mig_ch_Oth_ch_ch=A_ch_Oth*(w_ch_Oth_ch/price_deflator_ch)^kappa/ch_options;
mig_ch_Fin_ch_us=A_ch_Fin*(w_ch_Fin_us/price_deflator_ch)^kappa/ch_options;
mig_ch_Fin_ch_in=A_ch_Fin*(w_ch_Fin_in/price_deflator_ch)^kappa/ch_options;
mig_ch_Fin_ch_eu=A_ch_Fin*(w_ch_Fin_eu/price_deflator_ch)^kappa/ch_options;
mig_ch_Fin_ch_ca=A_ch_Fin*(w_ch_Fin_ca/price_deflator_ch)^kappa/ch_options;
mig_ch_Fin_ch_ch=A_ch_Fin*(w_ch_Fin_ch/price_deflator_ch)^kappa/ch_options;


%Other

ot_options=A_ot_IT*(w_us_IT_us_f/price_deflator_us)^kappa*phi_ot_us_us^(-kappa)*mig_ot(1,1)+A_ot_IT*(w_us_IT_in_f/price_deflator_us)^kappa*phi_ot_us_in^(-kappa)*mig_ot(1,2)...
    +A_ot_IT*(w_us_IT_eu_f/price_deflator_us)^kappa*phi_ot_us_eu^(-kappa)*mig_ot(1,3)+A_ot_IT*(w_us_IT_ca_f/price_deflator_us)^kappa*phi_ot_us_ca^(-kappa)*mig_ot(1,4)...
    +A_ot_IT*(w_us_IT_ch_f/price_deflator_us)^kappa*phi_ot_us_ch^(-kappa)*mig_ot(1,5)+A_ot_Man*(w_us_Man_us_f/price_deflator_us)^kappa*phi_ot_us_us^(-kappa)*mig_ot(1,6)...
    +A_ot_Man*(w_us_Man_in_f/price_deflator_us)^kappa*phi_ot_us_in^(-kappa)*mig_ot(1,7)+A_ot_Man*(w_us_Man_eu_f/price_deflator_us)^kappa*phi_ot_us_eu^(-kappa)*mig_ot(1,8)...
    +A_ot_Man*(w_us_Man_ca_f/price_deflator_us)^kappa*phi_ot_us_ca^(-kappa)*mig_ot(1,9)+A_ot_Man*(w_us_Man_ch_f/price_deflator_us)^kappa*phi_ot_us_ch^(-kappa)*mig_ot(1,10)...
    +A_ot_Oth*(w_us_Oth_us_f/price_deflator_us)^kappa*phi_ot_us_us^(-kappa)*mig_ot(1,11)...    
    +A_ot_IT*(w_eu_IT_us_f/price_deflator_eu)^kappa*phi_ot_eu_us^(-kappa)*mig_ot(1,12)...
    +A_ot_IT*(w_eu_IT_in_f/price_deflator_eu)^kappa*phi_ot_eu_in^(-kappa)*mig_ot(1,13)+A_ot_IT*(w_eu_IT_eu_f/price_deflator_eu)^kappa*phi_ot_eu_eu^(-kappa)*mig_ot(1,14)...
    +A_ot_IT*(w_eu_IT_ca_f/price_deflator_eu)^kappa*phi_ot_eu_ca^(-kappa)*mig_ot(1,15)+A_ot_IT*(w_eu_IT_ch_f/price_deflator_eu)^kappa*phi_ot_eu_ch^(-kappa)*mig_ot(1,16)...
    +A_ot_Man*(w_eu_Man_us_f/price_deflator_eu)^kappa*phi_ot_eu_us^(-kappa)*mig_ot(1,17)+A_ot_Man*(w_eu_Man_in_f/price_deflator_eu)^kappa*phi_ot_eu_in^(-kappa)*mig_ot(1,18)...
    +A_ot_Man*(w_eu_Man_eu_f/price_deflator_eu)^kappa*phi_ot_eu_eu^(-kappa)*mig_ot(1,19)+A_ot_Man*(w_eu_Man_ca_f/price_deflator_eu)^kappa*phi_ot_eu_ca^(-kappa)*mig_ot(1,20)...
    +A_ot_Man*(w_eu_Man_ch_f/price_deflator_eu)^kappa*phi_ot_eu_ch^(-kappa)*mig_ot(1,21)+A_ot_Oth*(w_eu_Oth_eu_f/price_deflator_eu)^kappa*phi_ot_eu_eu^(-kappa)*mig_ot(1,22)...
    +A_ot_IT*(w_ca_IT_us_f/price_deflator_ca)^kappa*phi_ot_ca_us^(-kappa)*mig_ot(1,23)...
    +A_ot_IT*(w_ca_IT_in_f/price_deflator_ca)^kappa*phi_ot_ca_in^(-kappa)*mig_ot(1,24)+A_ot_IT*(w_ca_IT_eu_f/price_deflator_ca)^kappa*phi_ot_ca_eu^(-kappa)*mig_ot(1,25)...
    +A_ot_IT*(w_ca_IT_ca_f/price_deflator_ca)^kappa*phi_ot_ca_ca^(-kappa)*mig_ot(1,26)+A_ot_IT*(w_ca_IT_ch_f/price_deflator_ca)^kappa*phi_ot_ca_ch^(-kappa)*mig_ot(1,27)...
    +A_ot_Man*(w_ca_Man_us_f/price_deflator_ca)^kappa*phi_ot_ca_us^(-kappa)*mig_ot(1,28)+A_ot_Man*(w_ca_Man_in_f/price_deflator_ca)^kappa*phi_ot_ca_in^(-kappa)*mig_ot(1,29)...
    +A_ot_Man*(w_ca_Man_eu_f/price_deflator_ca)^kappa*phi_ot_ca_eu^(-kappa)*mig_ot(1,30)+A_ot_Man*(w_ca_Man_ca_f/price_deflator_ca)^kappa*phi_ot_ca_ca^(-kappa)*mig_ot(1,31)...
    +A_ot_Man*(w_ca_Man_ch_f/price_deflator_ca)^kappa*phi_ot_ca_ch^(-kappa)*mig_ot(1,32)+A_ot_Oth*(w_ca_Oth_ca_f/price_deflator_ca)^kappa*phi_ot_ca_ca^(-kappa)*mig_ot(1,33)...
    +A_ot_IT*(w_ot_IT_ot/price_deflator_ot)^kappa*mig_ot(1,34)+A_ot_Man*(w_ot_Man_ot/price_deflator_ot)^kappa*mig_ot(1,35)+A_ot_Oth*(w_ot_Oth_ot/price_deflator_ot)^kappa*mig_ot(1,36)...
    +A_ot_Fin*(w_us_Fin_us_f/price_deflator_us)^kappa*phi_ot_us_us^(-kappa)*mig_ot(1,37)...
    +A_ot_Fin*(w_us_Fin_in_f/price_deflator_us)^kappa*phi_ot_us_in^(-kappa)*mig_ot(1,38)+A_ot_Fin*(w_us_Fin_eu_f/price_deflator_us)^kappa*phi_ot_us_eu^(-kappa)*mig_ot(1,39)...
    +A_ot_Fin*(w_us_Fin_ca_f/price_deflator_us)^kappa*phi_ot_us_ca^(-kappa)*mig_ot(1,40)+A_ot_Fin*(w_us_Fin_ch_f/price_deflator_us)^kappa*phi_ot_us_ch^(-kappa)*mig_ot(1,41)...
    +A_ot_Fin*(w_eu_Fin_us_f/price_deflator_eu)^kappa*phi_ot_eu_us^(-kappa)*mig_ot(1,42)+A_ot_Fin*(w_eu_Fin_in_f/price_deflator_eu)^kappa*phi_ot_eu_in^(-kappa)*mig_ot(1,43)...
    +A_ot_Fin*(w_eu_Fin_eu_f/price_deflator_eu)^kappa*phi_ot_eu_eu^(-kappa)*mig_ot(1,44)+A_ot_Fin*(w_eu_Fin_ca_f/price_deflator_eu)^kappa*phi_ot_eu_ca^(-kappa)*mig_ot(1,45)...
    +A_ot_Fin*(w_eu_Fin_ch_f/price_deflator_eu)^kappa*phi_ot_eu_ch^(-kappa)*mig_ot(1,46)...
    +A_ot_Fin*(w_ca_Fin_us_f/price_deflator_ca)^kappa*phi_ot_ca_us^(-kappa)*mig_ot(1,47)+A_ot_Fin*(w_ca_Fin_in_f/price_deflator_ca)^kappa*phi_ot_ca_in^(-kappa)*mig_ot(1,48)...
    +A_ot_Fin*(w_ca_Fin_eu_f/price_deflator_ca)^kappa*phi_ot_ca_eu^(-kappa)*mig_ot(1,49)+A_ot_Fin*(w_ca_Fin_ca_f/price_deflator_ca)^kappa*phi_ot_ca_ca^(-kappa)*mig_ot(1,50)...
    +A_ot_Fin*(w_ca_Fin_ch_f/price_deflator_ca)^kappa*phi_ot_ca_ch^(-kappa)*mig_ot(1,51)+A_ot_Fin*(w_ot_Fin_ot/price_deflator_ot)^kappa*mig_ot(1,52);




mig_ot_IT_us_us=A_ot_IT*(w_us_IT_us_f/price_deflator_us)^kappa*phi_ot_us_us^(-kappa)/ot_options;
mig_ot_IT_us_in=A_ot_IT*(w_us_IT_in_f/price_deflator_us)^kappa*phi_ot_us_in^(-kappa)/ot_options;
mig_ot_IT_us_eu=A_ot_IT*(w_us_IT_eu_f/price_deflator_us)^kappa*phi_ot_us_eu^(-kappa)/ot_options;
mig_ot_IT_us_ca=A_ot_IT*(w_us_IT_ca_f/price_deflator_us)^kappa*phi_ot_us_ca^(-kappa)/ot_options;
mig_ot_IT_us_ch=A_ot_IT*(w_us_IT_ch_f/price_deflator_us)^kappa*phi_ot_us_ch^(-kappa)/ot_options;

mig_ot_Man_us_us=A_ot_Man*(w_us_Man_us_f/price_deflator_us)^kappa*phi_ot_us_us^(-kappa)/ot_options;
mig_ot_Man_us_in=A_ot_Man*(w_us_Man_in_f/price_deflator_us)^kappa*phi_ot_us_in^(-kappa)/ot_options;
mig_ot_Man_us_eu=A_ot_Man*(w_us_Man_eu_f/price_deflator_us)^kappa*phi_ot_us_eu^(-kappa)/ot_options;
mig_ot_Man_us_ca=A_ot_Man*(w_us_Man_ca_f/price_deflator_us)^kappa*phi_ot_us_ca^(-kappa)/ot_options;
mig_ot_Man_us_ch=A_ot_Man*(w_us_Man_ch_f/price_deflator_us)^kappa*phi_ot_us_ch^(-kappa)/ot_options;

mig_ot_Oth_us_us=A_ot_Oth*(w_us_Oth_us_f/price_deflator_us)^kappa*phi_ot_us_us^(-kappa)/ot_options;

mig_ot_Fin_us_us=A_ot_Fin*(w_us_Fin_us_f/price_deflator_us)^kappa*phi_ot_us_us^(-kappa)/ot_options;
mig_ot_Fin_us_in=A_ot_Fin*(w_us_Fin_in_f/price_deflator_us)^kappa*phi_ot_us_in^(-kappa)/ot_options;
mig_ot_Fin_us_eu=A_ot_Fin*(w_us_Fin_eu_f/price_deflator_us)^kappa*phi_ot_us_eu^(-kappa)/ot_options;
mig_ot_Fin_us_ca=A_ot_Fin*(w_us_Fin_ca_f/price_deflator_us)^kappa*phi_ot_us_ca^(-kappa)/ot_options;
mig_ot_Fin_us_ch=A_ot_Fin*(w_us_Fin_ch_f/price_deflator_us)^kappa*phi_ot_us_ch^(-kappa)/ot_options;


mig_ot_IT_eu_us=A_ot_IT*(w_eu_IT_us_f/price_deflator_eu)^kappa*phi_ot_eu_us^(-kappa)/ot_options;
mig_ot_IT_eu_in=A_ot_IT*(w_eu_IT_in_f/price_deflator_eu)^kappa*phi_ot_eu_in^(-kappa)/ot_options;
mig_ot_IT_eu_eu=A_ot_IT*(w_eu_IT_eu_f/price_deflator_eu)^kappa*phi_ot_eu_eu^(-kappa)/ot_options;
mig_ot_IT_eu_ca=A_ot_IT*(w_eu_IT_ca_f/price_deflator_eu)^kappa*phi_ot_eu_ca^(-kappa)/ot_options;
mig_ot_IT_eu_ch=A_ot_IT*(w_eu_IT_ch_f/price_deflator_eu)^kappa*phi_ot_eu_ch^(-kappa)/ot_options;

mig_ot_Man_eu_us=A_ot_Man*(w_eu_Man_us_f/price_deflator_eu)^kappa*phi_ot_eu_us^(-kappa)/ot_options;
mig_ot_Man_eu_in=A_ot_Man*(w_eu_Man_in_f/price_deflator_eu)^kappa*phi_ot_eu_in^(-kappa)/ot_options;
mig_ot_Man_eu_eu=A_ot_Man*(w_eu_Man_eu_f/price_deflator_eu)^kappa*phi_ot_eu_eu^(-kappa)/ot_options;
mig_ot_Man_eu_ca=A_ot_Man*(w_eu_Man_ca_f/price_deflator_eu)^kappa*phi_ot_eu_ca^(-kappa)/ot_options;
mig_ot_Man_eu_ch=A_ot_Man*(w_eu_Man_ch_f/price_deflator_eu)^kappa*phi_ot_eu_ch^(-kappa)/ot_options;

mig_ot_Oth_eu_eu=A_ot_Oth*(w_eu_Oth_eu_f/price_deflator_eu)^kappa*phi_ot_eu_eu^(-kappa)/ot_options;

mig_ot_Fin_eu_us=A_ot_Fin*(w_eu_Fin_us_f/price_deflator_eu)^kappa*phi_ot_eu_us^(-kappa)/ot_options;
mig_ot_Fin_eu_in=A_ot_Fin*(w_eu_Fin_in_f/price_deflator_eu)^kappa*phi_ot_eu_in^(-kappa)/ot_options;
mig_ot_Fin_eu_eu=A_ot_Fin*(w_eu_Fin_eu_f/price_deflator_eu)^kappa*phi_ot_eu_eu^(-kappa)/ot_options;
mig_ot_Fin_eu_ca=A_ot_Fin*(w_eu_Fin_ca_f/price_deflator_eu)^kappa*phi_ot_eu_ca^(-kappa)/ot_options;
mig_ot_Fin_eu_ch=A_ot_Fin*(w_eu_Fin_ch_f/price_deflator_eu)^kappa*phi_ot_eu_ch^(-kappa)/ot_options;


mig_ot_IT_ca_us=A_ot_IT*(w_ca_IT_us_f/price_deflator_ca)^kappa*phi_ot_ca_us^(-kappa)/ot_options;
mig_ot_IT_ca_in=A_ot_IT*(w_ca_IT_in_f/price_deflator_ca)^kappa*phi_ot_ca_in^(-kappa)/ot_options;
mig_ot_IT_ca_eu=A_ot_IT*(w_ca_IT_eu_f/price_deflator_ca)^kappa*phi_ot_ca_eu^(-kappa)/ot_options;
mig_ot_IT_ca_ca=A_ot_IT*(w_ca_IT_ca_f/price_deflator_ca)^kappa*phi_ot_ca_ca^(-kappa)/ot_options;
mig_ot_IT_ca_ch=A_ot_IT*(w_ca_IT_ch_f/price_deflator_ca)^kappa*phi_ot_ca_ch^(-kappa)/ot_options;

mig_ot_Man_ca_us=A_ot_Man*(w_ca_Man_us_f/price_deflator_ca)^kappa*phi_ot_ca_us^(-kappa)/ot_options;
mig_ot_Man_ca_in=A_ot_Man*(w_ca_Man_in_f/price_deflator_ca)^kappa*phi_ot_ca_in^(-kappa)/ot_options;
mig_ot_Man_ca_eu=A_ot_Man*(w_ca_Man_eu_f/price_deflator_ca)^kappa*phi_ot_ca_eu^(-kappa)/ot_options;
mig_ot_Man_ca_ca=A_ot_Man*(w_ca_Man_ca_f/price_deflator_ca)^kappa*phi_ot_ca_ca^(-kappa)/ot_options;
mig_ot_Man_ca_ch=A_ot_Man*(w_ca_Man_ch_f/price_deflator_ca)^kappa*phi_ot_ca_ch^(-kappa)/ot_options;

mig_ot_Oth_ca_ca=A_ot_Oth*(w_ca_Oth_ca_f/price_deflator_ca)^kappa*phi_ot_ca_ca^(-kappa)/ot_options;

mig_ot_Fin_ca_us=A_ot_Fin*(w_ca_Fin_us_f/price_deflator_ca)^kappa*phi_ot_ca_us^(-kappa)/ot_options;
mig_ot_Fin_ca_in=A_ot_Fin*(w_ca_Fin_in_f/price_deflator_ca)^kappa*phi_ot_ca_in^(-kappa)/ot_options;
mig_ot_Fin_ca_eu=A_ot_Fin*(w_ca_Fin_eu_f/price_deflator_ca)^kappa*phi_ot_ca_eu^(-kappa)/ot_options;
mig_ot_Fin_ca_ca=A_ot_Fin*(w_ca_Fin_ca_f/price_deflator_ca)^kappa*phi_ot_ca_ca^(-kappa)/ot_options;
mig_ot_Fin_ca_ch=A_ot_Fin*(w_ca_Fin_ch_f/price_deflator_ca)^kappa*phi_ot_ca_ch^(-kappa)/ot_options;

mig_ot_IT_ot_ot=A_ot_IT*(w_ot_IT_ot/price_deflator_ot)^kappa/ot_options;
mig_ot_Man_ot_ot=A_ot_Man*(w_ot_Man_ot/price_deflator_ot)^kappa/ot_options;
mig_ot_Oth_ot_ot=A_ot_Oth*(w_ot_Oth_ot/price_deflator_ot)^kappa/ot_options;
mig_ot_Fin_ot_ot=A_ot_Fin*(w_ot_Fin_ot/price_deflator_ot)^kappa/ot_options;


%MNE costs



delta_us_in_IT=deltab_us_in_IT*(mig_in_IT_us_us)^-nu;
delta_us_eu_IT=deltab_us_eu_IT*(mig_eu_IT_us_us)^-nu;
delta_us_ca_IT=deltab_us_ca_IT*(mig_ca_IT_us_us)^-nu;
delta_us_ch_IT=deltab_us_ch_IT*(mig_ch_IT_us_us)^-nu;

delta_us_in_Man=deltab_us_in_Man*(mig_in_Man_us_us)^-nu;
delta_us_eu_Man=deltab_us_eu_Man*(mig_eu_Man_us_us)^-nu;
delta_us_ca_Man=deltab_us_ca_Man*(mig_ca_Man_us_us)^-nu;
delta_us_ch_Man=deltab_us_ch_Man*(mig_ch_Man_us_us)^-nu;


delta_us_in_Fin=deltab_us_in_Fin*(mig_in_Fin_us_us)^-nu;
delta_us_eu_Fin=deltab_us_eu_Fin*(mig_eu_Fin_us_us)^-nu;
delta_us_ca_Fin=deltab_us_ca_Fin*(mig_ca_Fin_us_us)^-nu;
delta_us_ch_Fin=deltab_us_ch_Fin*(mig_ch_Fin_us_us)^-nu;


%Companies in India
delta_in_us_IT=deltab_in_us_IT;
delta_in_eu_IT=deltab_in_eu_IT;
delta_in_ca_IT=deltab_in_ca_IT;
delta_in_ch_IT=deltab_in_ch_IT;

delta_in_us_Man=deltab_in_us_Man;
delta_in_eu_Man=deltab_in_eu_Man;
delta_in_ca_Man=deltab_in_ca_Man;
delta_in_ch_Man=deltab_in_ch_Man;

delta_in_us_Fin=deltab_in_us_Fin;
delta_in_eu_Fin=deltab_in_eu_Fin;
delta_in_ca_Fin=deltab_in_ca_Fin;
delta_in_ch_Fin=deltab_in_ch_Fin;


%Companies eu 

delta_eu_us_IT=deltab_eu_us_IT*(mig_us_IT_eu_eu)^-nu;
delta_eu_in_IT=deltab_eu_in_IT*(mig_in_IT_eu_eu)^-nu;
delta_eu_ca_IT=deltab_eu_ca_IT*(mig_ca_IT_eu_eu)^-nu;
delta_eu_ch_IT=deltab_eu_ch_IT*(mig_ch_IT_eu_eu)^-nu;

delta_eu_us_Man=deltab_eu_us_Man*(mig_us_Man_eu_eu)^-nu;
delta_eu_in_Man=deltab_eu_in_Man*(mig_in_Man_eu_eu)^-nu;
delta_eu_ca_Man=deltab_eu_ca_Man*(mig_ca_Man_eu_eu)^-nu;
delta_eu_ch_Man=deltab_eu_ch_Man*(mig_ch_Man_eu_eu)^-nu;

delta_eu_us_Fin=deltab_eu_us_Fin*(mig_us_Fin_eu_eu)^-nu;
delta_eu_in_Fin=deltab_eu_in_Fin*(mig_in_Fin_eu_eu)^-nu;
delta_eu_ca_Fin=deltab_eu_ca_Fin*(mig_ca_Fin_eu_eu)^-nu;
delta_eu_ch_Fin=deltab_eu_ch_Fin*(mig_ch_Fin_eu_eu)^-nu;


%Companies ca
delta_ca_us_IT=deltab_ca_us_IT*(mig_us_IT_ca_ca)^-nu;
delta_ca_in_IT=deltab_ca_in_IT*(mig_in_IT_ca_ca)^-nu;
delta_ca_eu_IT=deltab_ca_eu_IT*(mig_eu_IT_ca_ca)^-nu;
delta_ca_ch_IT=deltab_ca_ch_IT*(mig_ch_IT_ca_ca)^-nu;

delta_ca_us_Man=deltab_ca_us_Man*(mig_us_Man_ca_ca)^-nu;
delta_ca_in_Man=deltab_ca_in_Man*(mig_in_Man_ca_ca)^-nu;
delta_ca_eu_Man=deltab_ca_eu_Man*(mig_eu_Man_ca_ca)^-nu;
delta_ca_ch_Man=deltab_ca_ch_Man*(mig_ch_Man_ca_ca)^-nu;

delta_ca_us_Fin=deltab_ca_us_Fin*(mig_us_Fin_ca_ca)^-nu;
delta_ca_in_Fin=deltab_ca_in_Fin*(mig_in_Fin_ca_ca)^-nu;
delta_ca_eu_Fin=deltab_ca_eu_Fin*(mig_eu_Fin_ca_ca)^-nu;
delta_ca_ch_Fin=deltab_ca_ch_Fin*(mig_ch_Fin_ca_ca)^-nu;


%Companies ch
delta_ch_us_IT=deltab_ch_us_IT;
delta_ch_in_IT=deltab_ch_in_IT;
delta_ch_eu_IT=deltab_ch_eu_IT;
delta_ch_ca_IT=deltab_ch_ca_IT;

delta_ch_us_Man=deltab_ch_us_Man;
delta_ch_in_Man=deltab_ch_in_Man;
delta_ch_eu_Man=deltab_ch_eu_Man;
delta_ch_ca_Man=deltab_ch_ca_Man;

delta_ch_us_Fin=deltab_ch_us_Fin;
delta_ch_in_Fin=deltab_ch_in_Fin;
delta_ch_eu_Fin=deltab_ch_eu_Fin;
delta_ch_ca_Fin=deltab_ch_ca_Fin;


%Unit cost of production high-skill immigrants - for MNEs

%US
costfs_us_IT_in=(psi_s^iota*w_us_IT_in_s^(1-iota)*(skill_shares_us_in(1,2)/(skill_shares_us_in(1,2)+skill_shares_us_in(1,3)))+psi_f^iota*w_us_IT_in_f^(1-iota)*(skill_shares_us_in(1,3)/(skill_shares_us_in(1,2)+skill_shares_us_in(1,3))))^(1/(1-iota));
costfs_us_IT_eu=(psi_s^iota*w_us_IT_eu_s^(1-iota)*(skill_shares_us_eu(1,2)/(skill_shares_us_eu(1,2)+skill_shares_us_eu(1,3)))+psi_f^iota*w_us_IT_eu_f^(1-iota)*(skill_shares_us_eu(1,3)/(skill_shares_us_eu(1,2)+skill_shares_us_eu(1,3))))^(1/(1-iota));
costfs_us_IT_ca=(psi_s^iota*w_us_IT_ca_s^(1-iota)*(skill_shares_us_ca(1,2)/(skill_shares_us_ca(1,2)+skill_shares_us_ca(1,3)))+psi_f^iota*w_us_IT_ca_f^(1-iota)*(skill_shares_us_ca(1,3)/(skill_shares_us_ca(1,2)+skill_shares_us_ca(1,3))))^(1/(1-iota));
costfs_us_IT_ch=(psi_s^iota*w_us_IT_ch_s^(1-iota)*(skill_shares_us_ch(1,2)/(skill_shares_us_ch(1,2)+skill_shares_us_ch(1,3)))+psi_f^iota*w_us_IT_ch_f^(1-iota)*(skill_shares_us_ch(1,3)/(skill_shares_us_ch(1,2)+skill_shares_us_ch(1,3))))^(1/(1-iota));


costfs_us_Man_in=(psi_s^iota*w_us_Man_in_s^(1-iota)*(skill_shares_us_in(1,5)/(skill_shares_us_in(1,5)+skill_shares_us_in(1,6)))+psi_f^iota*w_us_Man_in_f^(1-iota)*(skill_shares_us_in(1,6)/(skill_shares_us_in(1,5)+skill_shares_us_in(1,6))))^(1/(1-iota));
costfs_us_Man_eu=(psi_s^iota*w_us_Man_eu_s^(1-iota)*(skill_shares_us_eu(1,5)/(skill_shares_us_eu(1,5)+skill_shares_us_eu(1,6)))+psi_f^iota*w_us_Man_eu_f^(1-iota)*(skill_shares_us_eu(1,6)/(skill_shares_us_eu(1,5)+skill_shares_us_eu(1,6))))^(1/(1-iota));
costfs_us_Man_ca=(psi_s^iota*w_us_Man_ca_s^(1-iota)*(skill_shares_us_ca(1,5)/(skill_shares_us_ca(1,5)+skill_shares_us_ca(1,6)))+psi_f^iota*w_us_Man_ca_f^(1-iota)*(skill_shares_us_ca(1,6)/(skill_shares_us_ca(1,5)+skill_shares_us_ca(1,6))))^(1/(1-iota));
costfs_us_Man_ch=(psi_s^iota*w_us_Man_ch_s^(1-iota)*(skill_shares_us_ch(1,5)/(skill_shares_us_ch(1,5)+skill_shares_us_ch(1,6)))+psi_f^iota*w_us_Man_ch_f^(1-iota)*(skill_shares_us_ch(1,6)/(skill_shares_us_ch(1,5)+skill_shares_us_ch(1,6))))^(1/(1-iota));


costfs_us_Fin_in=(psi_s^iota*w_us_Fin_in_s^(1-iota)*(skill_shares_us_in(1,8)/(skill_shares_us_in(1,8)+skill_shares_us_in(1,9)))+psi_f^iota*w_us_Fin_in_f^(1-iota)*(skill_shares_us_in(1,9)/(skill_shares_us_in(1,8)+skill_shares_us_in(1,9))))^(1/(1-iota));
costfs_us_Fin_eu=(psi_s^iota*w_us_Fin_eu_s^(1-iota)*(skill_shares_us_eu(1,8)/(skill_shares_us_eu(1,8)+skill_shares_us_eu(1,9)))+psi_f^iota*w_us_Fin_eu_f^(1-iota)*(skill_shares_us_eu(1,9)/(skill_shares_us_eu(1,8)+skill_shares_us_eu(1,9))))^(1/(1-iota));
costfs_us_Fin_ca=(psi_s^iota*w_us_Fin_ca_s^(1-iota)*(skill_shares_us_ca(1,8)/(skill_shares_us_ca(1,8)+skill_shares_us_ca(1,9)))+psi_f^iota*w_us_Fin_ca_f^(1-iota)*(skill_shares_us_ca(1,9)/(skill_shares_us_ca(1,8)+skill_shares_us_ca(1,9))))^(1/(1-iota));
costfs_us_Fin_ch=(psi_s^iota*w_us_Fin_ch_s^(1-iota)*(skill_shares_us_ch(1,8)/(skill_shares_us_ch(1,8)+skill_shares_us_ch(1,9)))+psi_f^iota*w_us_Fin_ch_f^(1-iota)*(skill_shares_us_ch(1,9)/(skill_shares_us_ch(1,8)+skill_shares_us_ch(1,9))))^(1/(1-iota));


%Europe

costfs_eu_IT_in=(psi_s^iota*w_eu_IT_in_s^(1-iota)*(skill_shares_eu_in(1,2)/(skill_shares_eu_in(1,2)+skill_shares_eu_in(1,3)))+psi_f^iota*w_eu_IT_in_f^(1-iota)*(skill_shares_eu_in(1,3)/(skill_shares_eu_in(1,2)+skill_shares_eu_in(1,3))))^(1/(1-iota));
costfs_eu_IT_us=(psi_s^iota*w_eu_IT_us_s^(1-iota)*(skill_shares_eu_us(1,2)/(skill_shares_eu_us(1,2)+skill_shares_eu_us(1,3)))+psi_f^iota*w_eu_IT_us_f^(1-iota)*(skill_shares_eu_us(1,3)/(skill_shares_eu_us(1,2)+skill_shares_eu_us(1,3))))^(1/(1-iota));
costfs_eu_IT_ca=(psi_s^iota*w_eu_IT_ca_s^(1-iota)*(skill_shares_eu_ca(1,2)/(skill_shares_eu_ca(1,2)+skill_shares_eu_ca(1,3)))+psi_f^iota*w_eu_IT_ca_f^(1-iota)*(skill_shares_eu_ca(1,3)/(skill_shares_eu_ca(1,2)+skill_shares_eu_ca(1,3))))^(1/(1-iota));
costfs_eu_IT_ch=(psi_s^iota*w_eu_IT_ch_s^(1-iota)*(skill_shares_eu_ch(1,2)/(skill_shares_eu_ch(1,2)+skill_shares_eu_ch(1,3)))+psi_f^iota*w_eu_IT_ch_f^(1-iota)*(skill_shares_eu_ch(1,3)/(skill_shares_eu_ch(1,2)+skill_shares_eu_ch(1,3))))^(1/(1-iota));

costfs_eu_Man_in=(psi_s^iota*w_eu_Man_in_s^(1-iota)*(skill_shares_eu_in(1,5)/(skill_shares_eu_in(1,5)+skill_shares_eu_in(1,6)))+psi_f^iota*w_eu_Man_in_f^(1-iota)*(skill_shares_eu_in(1,6)/(skill_shares_eu_in(1,5)+skill_shares_eu_in(1,6))))^(1/(1-iota));
costfs_eu_Man_us=(psi_s^iota*w_eu_Man_us_s^(1-iota)*(skill_shares_eu_us(1,5)/(skill_shares_eu_us(1,5)+skill_shares_eu_us(1,6)))+psi_f^iota*w_eu_Man_us_f^(1-iota)*(skill_shares_eu_us(1,6)/(skill_shares_eu_us(1,5)+skill_shares_eu_us(1,6))))^(1/(1-iota));
costfs_eu_Man_ca=(psi_s^iota*w_eu_Man_ca_s^(1-iota)*(skill_shares_eu_ca(1,5)/(skill_shares_eu_ca(1,5)+skill_shares_eu_ca(1,6)))+psi_f^iota*w_eu_Man_ca_f^(1-iota)*(skill_shares_eu_ca(1,6)/(skill_shares_eu_ca(1,5)+skill_shares_eu_ca(1,6))))^(1/(1-iota));
costfs_eu_Man_ch=(psi_s^iota*w_eu_Man_ch_s^(1-iota)*(skill_shares_eu_ch(1,5)/(skill_shares_eu_ch(1,5)+skill_shares_eu_ch(1,6)))+psi_f^iota*w_eu_Man_ch_f^(1-iota)*(skill_shares_eu_ch(1,6)/(skill_shares_eu_ch(1,5)+skill_shares_eu_ch(1,6))))^(1/(1-iota));

costfs_eu_Fin_in=(psi_s^iota*w_eu_Fin_in_s^(1-iota)*(skill_shares_eu_in(1,8)/(skill_shares_eu_in(1,8)+skill_shares_eu_in(1,9)))+psi_f^iota*w_eu_Fin_in_f^(1-iota)*(skill_shares_eu_in(1,9)/(skill_shares_eu_in(1,8)+skill_shares_eu_in(1,9))))^(1/(1-iota));
costfs_eu_Fin_us=(psi_s^iota*w_eu_Fin_us_s^(1-iota)*(skill_shares_eu_us(1,8)/(skill_shares_eu_us(1,8)+skill_shares_eu_us(1,9)))+psi_f^iota*w_eu_Fin_us_f^(1-iota)*(skill_shares_eu_us(1,9)/(skill_shares_eu_us(1,8)+skill_shares_eu_us(1,9))))^(1/(1-iota));
costfs_eu_Fin_ca=(psi_s^iota*w_eu_Fin_ca_s^(1-iota)*(skill_shares_eu_ca(1,8)/(skill_shares_eu_ca(1,8)+skill_shares_eu_ca(1,9)))+psi_f^iota*w_eu_Fin_ca_f^(1-iota)*(skill_shares_eu_ca(1,9)/(skill_shares_eu_ca(1,8)+skill_shares_eu_ca(1,9))))^(1/(1-iota));
costfs_eu_Fin_ch=(psi_s^iota*w_eu_Fin_ch_s^(1-iota)*(skill_shares_eu_ch(1,8)/(skill_shares_eu_ch(1,8)+skill_shares_eu_ch(1,9)))+psi_f^iota*w_eu_Fin_ch_f^(1-iota)*(skill_shares_eu_ch(1,9)/(skill_shares_eu_ch(1,8)+skill_shares_eu_ch(1,9))))^(1/(1-iota));


%Canada

costfs_ca_IT_in=(psi_s^iota*w_ca_IT_in_s^(1-iota)*(skill_shares_ca_in(1,2)/(skill_shares_ca_in(1,2)+skill_shares_ca_in(1,3)))+psi_f^iota*w_ca_IT_in_f^(1-iota)*(skill_shares_ca_in(1,3)/(skill_shares_ca_in(1,2)+skill_shares_ca_in(1,3))))^(1/(1-iota));
costfs_ca_IT_eu=(psi_s^iota*w_ca_IT_eu_s^(1-iota)*(skill_shares_ca_eu(1,2)/(skill_shares_ca_eu(1,2)+skill_shares_ca_eu(1,3)))+psi_f^iota*w_ca_IT_eu_f^(1-iota)*(skill_shares_ca_eu(1,3)/(skill_shares_ca_eu(1,2)+skill_shares_ca_eu(1,3))))^(1/(1-iota));
costfs_ca_IT_us=(psi_s^iota*w_ca_IT_us_s^(1-iota)*(skill_shares_ca_us(1,2)/(skill_shares_ca_us(1,2)+skill_shares_ca_us(1,3)))+psi_f^iota*w_ca_IT_us_f^(1-iota)*(skill_shares_ca_us(1,3)/(skill_shares_ca_us(1,2)+skill_shares_ca_us(1,3))))^(1/(1-iota));
costfs_ca_IT_ch=(psi_s^iota*w_ca_IT_ch_s^(1-iota)*(skill_shares_ca_ch(1,2)/(skill_shares_ca_ch(1,2)+skill_shares_ca_ch(1,3)))+psi_f^iota*w_ca_IT_ch_f^(1-iota)*(skill_shares_ca_ch(1,3)/(skill_shares_ca_ch(1,2)+skill_shares_ca_ch(1,3))))^(1/(1-iota));

costfs_ca_Man_in=(psi_s^iota*w_ca_Man_in_s^(1-iota)*(skill_shares_ca_in(1,5)/(skill_shares_ca_in(1,5)+skill_shares_ca_in(1,6)))+psi_f^iota*w_ca_Man_in_f^(1-iota)*(skill_shares_ca_in(1,6)/(skill_shares_ca_in(1,5)+skill_shares_ca_in(1,6))))^(1/(1-iota));
costfs_ca_Man_eu=(psi_s^iota*w_ca_Man_eu_s^(1-iota)*(skill_shares_ca_eu(1,5)/(skill_shares_ca_eu(1,5)+skill_shares_ca_eu(1,6)))+psi_f^iota*w_ca_Man_eu_f^(1-iota)*(skill_shares_ca_eu(1,6)/(skill_shares_ca_eu(1,5)+skill_shares_ca_eu(1,6))))^(1/(1-iota));
costfs_ca_Man_us=(psi_s^iota*w_ca_Man_us_s^(1-iota)*(skill_shares_ca_us(1,5)/(skill_shares_ca_us(1,5)+skill_shares_ca_us(1,6)))+psi_f^iota*w_ca_Man_us_f^(1-iota)*(skill_shares_ca_us(1,6)/(skill_shares_ca_us(1,5)+skill_shares_ca_us(1,6))))^(1/(1-iota));
costfs_ca_Man_ch=(psi_s^iota*w_ca_Man_ch_s^(1-iota)*(skill_shares_ca_ch(1,5)/(skill_shares_ca_ch(1,5)+skill_shares_ca_ch(1,6)))+psi_f^iota*w_ca_Man_ch_f^(1-iota)*(skill_shares_ca_ch(1,6)/(skill_shares_ca_ch(1,5)+skill_shares_ca_ch(1,6))))^(1/(1-iota));

costfs_ca_Fin_in=(psi_s^iota*w_ca_Fin_in_s^(1-iota)*(skill_shares_ca_in(1,8)/(skill_shares_ca_in(1,8)+skill_shares_ca_in(1,9)))+psi_f^iota*w_ca_Fin_in_f^(1-iota)*(skill_shares_ca_in(1,9)/(skill_shares_ca_in(1,8)+skill_shares_ca_in(1,9))))^(1/(1-iota));
costfs_ca_Fin_eu=(psi_s^iota*w_ca_Fin_eu_s^(1-iota)*(skill_shares_ca_eu(1,8)/(skill_shares_ca_eu(1,8)+skill_shares_ca_eu(1,9)))+psi_f^iota*w_ca_Fin_eu_f^(1-iota)*(skill_shares_ca_eu(1,9)/(skill_shares_ca_eu(1,8)+skill_shares_ca_eu(1,9))))^(1/(1-iota));
costfs_ca_Fin_us=(psi_s^iota*w_ca_Fin_us_s^(1-iota)*(skill_shares_ca_us(1,8)/(skill_shares_ca_us(1,8)+skill_shares_ca_us(1,9)))+psi_f^iota*w_ca_Fin_us_f^(1-iota)*(skill_shares_ca_us(1,9)/(skill_shares_ca_us(1,8)+skill_shares_ca_us(1,9))))^(1/(1-iota));
costfs_ca_Fin_ch=(psi_s^iota*w_ca_Fin_ch_s^(1-iota)*(skill_shares_ca_ch(1,8)/(skill_shares_ca_ch(1,8)+skill_shares_ca_ch(1,9)))+psi_f^iota*w_ca_Fin_ch_f^(1-iota)*(skill_shares_ca_ch(1,9)/(skill_shares_ca_ch(1,8)+skill_shares_ca_ch(1,9))))^(1/(1-iota));


%Unit cost of production high-skill labor
%US
costh_us_IT_us=(psi_d^lambda*w_us_IT_us_d^(1-lambda)*skill_shares_us_us(1,1)+psi_f^lambda*w_us_IT_us_f^(1-lambda)*skill_shares_us_us(1,2))^(1/(1-lambda));
costh_us_IT_in=(psi_d^lambda*w_us_IT_in_d^(1-lambda)*skill_shares_us_in(1,1)+psi_f^lambda*costfs_us_IT_in^(1-lambda)*(skill_shares_us_in(1,3)+skill_shares_us_in(1,2)))^(1/(1-lambda));
costh_us_IT_eu=(psi_d^lambda*w_us_IT_eu_d^(1-lambda)*skill_shares_us_eu(1,1)+psi_f^lambda*costfs_us_IT_eu^(1-lambda)*(skill_shares_us_eu(1,3)+skill_shares_us_eu(1,2)))^(1/(1-lambda));
costh_us_IT_ca=(psi_d^lambda*w_us_IT_ca_d^(1-lambda)*skill_shares_us_ca(1,1)+psi_f^lambda*costfs_us_IT_ca^(1-lambda)*(skill_shares_us_ca(1,3)+skill_shares_us_ca(1,2)))^(1/(1-lambda));
costh_us_IT_ch=(psi_d^lambda*w_us_IT_ch_d^(1-lambda)*skill_shares_us_ch(1,1)+psi_f^lambda*costfs_us_IT_ch^(1-lambda)*(skill_shares_us_ch(1,3)+skill_shares_us_ch(1,2)))^(1/(1-lambda));

costh_us_Man_us=(psi_d^lambda*w_us_Man_us_d^(1-lambda)*skill_shares_us_us(1,3)+psi_f^lambda*w_us_Man_us_f^(1-lambda)*skill_shares_us_us(1,4))^(1/(1-lambda));
costh_us_Man_in=(psi_d^lambda*w_us_Man_in_d^(1-lambda)*skill_shares_us_in(1,4)+psi_f^lambda*costfs_us_Man_in^(1-lambda)*(skill_shares_us_in(1,6)+skill_shares_us_in(1,5)))^(1/(1-lambda));
costh_us_Man_eu=(psi_d^lambda*w_us_Man_eu_d^(1-lambda)*skill_shares_us_eu(1,4)+psi_f^lambda*costfs_us_Man_eu^(1-lambda)*(skill_shares_us_eu(1,6)+skill_shares_us_eu(1,5)))^(1/(1-lambda));
costh_us_Man_ca=(psi_d^lambda*w_us_Man_ca_d^(1-lambda)*skill_shares_us_ca(1,4)+psi_f^lambda*costfs_us_Man_ca^(1-lambda)*(skill_shares_us_ca(1,6)+skill_shares_us_ca(1,5)))^(1/(1-lambda));
costh_us_Man_ch=(psi_d^lambda*w_us_Man_ch_d^(1-lambda)*skill_shares_us_ch(1,4)+psi_f^lambda*costfs_us_Man_ch^(1-lambda)*(skill_shares_us_ch(1,6)+skill_shares_us_ch(1,5)))^(1/(1-lambda));

costh_us_Oth_us=(psi_d^lambda*w_us_Oth_us_d^(1-lambda)*skill_shares_us_us(1,5)+psi_f^lambda*w_us_Oth_us_f^(1-lambda)*skill_shares_us_us(1,6))^(1/(1-lambda));


costh_us_Fin_us=(psi_d^lambda*w_us_Fin_us_d^(1-lambda)*skill_shares_us_us(1,7)+psi_f^lambda*w_us_Fin_us_f^(1-lambda)*skill_shares_us_us(1,8))^(1/(1-lambda));
costh_us_Fin_in=(psi_d^lambda*w_us_Fin_in_d^(1-lambda)*skill_shares_us_in(1,7)+psi_f^lambda*costfs_us_Fin_in^(1-lambda)*(skill_shares_us_in(1,8)+skill_shares_us_in(1,9)))^(1/(1-lambda));
costh_us_Fin_eu=(psi_d^lambda*w_us_Fin_eu_d^(1-lambda)*skill_shares_us_eu(1,7)+psi_f^lambda*costfs_us_Fin_eu^(1-lambda)*(skill_shares_us_eu(1,8)+skill_shares_us_eu(1,9)))^(1/(1-lambda));
costh_us_Fin_ca=(psi_d^lambda*w_us_Fin_ca_d^(1-lambda)*skill_shares_us_ca(1,7)+psi_f^lambda*costfs_us_Fin_ca^(1-lambda)*(skill_shares_us_ca(1,8)+skill_shares_us_ca(1,9)))^(1/(1-lambda));
costh_us_Fin_ch=(psi_d^lambda*w_us_Fin_ch_d^(1-lambda)*skill_shares_us_ch(1,7)+psi_f^lambda*costfs_us_Fin_ch^(1-lambda)*(skill_shares_us_ch(1,8)+skill_shares_us_ch(1,9)))^(1/(1-lambda));


%Europe
costh_eu_IT_eu=(psi_d^lambda*w_eu_IT_eu_d^(1-lambda)*skill_shares_eu_eu(1,1)+psi_f^lambda*w_eu_IT_eu_f^(1-lambda)*skill_shares_eu_eu(1,2))^(1/(1-lambda));
costh_eu_IT_in=(psi_d^lambda*w_eu_IT_in_d^(1-lambda)*skill_shares_eu_in(1,1)+psi_f^lambda*costfs_eu_IT_in^(1-lambda)*(skill_shares_eu_in(1,3)+skill_shares_eu_in(1,2)))^(1/(1-lambda));
costh_eu_IT_us=(psi_d^lambda*w_eu_IT_us_d^(1-lambda)*skill_shares_eu_us(1,1)+psi_f^lambda*costfs_eu_IT_us^(1-lambda)*(skill_shares_eu_us(1,3)+skill_shares_eu_us(1,2)))^(1/(1-lambda));
costh_eu_IT_ca=(psi_d^lambda*w_eu_IT_ca_d^(1-lambda)*skill_shares_eu_ca(1,1)+psi_f^lambda*costfs_eu_IT_ca^(1-lambda)*(skill_shares_eu_ca(1,3)+skill_shares_eu_ca(1,2)))^(1/(1-lambda));
costh_eu_IT_ch=(psi_d^lambda*w_eu_IT_ch_d^(1-lambda)*skill_shares_eu_ch(1,1)+psi_f^lambda*costfs_eu_IT_ch^(1-lambda)*(skill_shares_eu_ch(1,3)+skill_shares_eu_ch(1,2)))^(1/(1-lambda));


costh_eu_Man_eu=(psi_d^lambda*w_eu_Man_eu_d^(1-lambda)*skill_shares_eu_eu(1,3)+psi_f^lambda*w_eu_Man_eu_f^(1-lambda)*skill_shares_eu_eu(1,4))^(1/(1-lambda));
costh_eu_Man_in=(psi_d^lambda*w_eu_Man_in_d^(1-lambda)*skill_shares_eu_in(1,4)+psi_f^lambda*costfs_eu_Man_in^(1-lambda)*(skill_shares_eu_in(1,6)+skill_shares_eu_in(1,5)))^(1/(1-lambda));
costh_eu_Man_us=(psi_d^lambda*w_eu_Man_us_d^(1-lambda)*skill_shares_eu_us(1,4)+psi_f^lambda*costfs_eu_Man_us^(1-lambda)*(skill_shares_eu_us(1,6)+skill_shares_eu_us(1,5)))^(1/(1-lambda));
costh_eu_Man_ca=(psi_d^lambda*w_eu_Man_ca_d^(1-lambda)*skill_shares_eu_ca(1,4)+psi_f^lambda*costfs_eu_Man_ca^(1-lambda)*(skill_shares_eu_ca(1,6)+skill_shares_eu_ca(1,5)))^(1/(1-lambda));
costh_eu_Man_ch=(psi_d^lambda*w_eu_Man_ch_d^(1-lambda)*skill_shares_eu_ch(1,4)+psi_f^lambda*costfs_eu_Man_ch^(1-lambda)*(skill_shares_eu_ch(1,6)+skill_shares_eu_ch(1,5)))^(1/(1-lambda));

costh_eu_Oth_eu=(psi_d^lambda*w_eu_Oth_eu_d^(1-lambda)*skill_shares_eu_eu(1,5)+psi_f^lambda*w_eu_Oth_eu_f^(1-lambda)*skill_shares_eu_eu(1,6))^(1/(1-lambda));

costh_eu_Fin_eu=(psi_d^lambda*w_eu_Fin_eu_d^(1-lambda)*skill_shares_eu_eu(1,7)+psi_f^lambda*w_eu_Fin_eu_f^(1-lambda)*skill_shares_eu_eu(1,8))^(1/(1-lambda));
costh_eu_Fin_in=(psi_d^lambda*w_eu_Fin_in_d^(1-lambda)*skill_shares_eu_in(1,7)+psi_f^lambda*costfs_eu_Fin_in^(1-lambda)*(skill_shares_eu_in(1,8)+skill_shares_eu_in(1,9)))^(1/(1-lambda));
costh_eu_Fin_us=(psi_d^lambda*w_eu_Fin_us_d^(1-lambda)*skill_shares_eu_us(1,7)+psi_f^lambda*costfs_eu_Fin_us^(1-lambda)*(skill_shares_eu_us(1,8)+skill_shares_eu_us(1,9)))^(1/(1-lambda));
costh_eu_Fin_ca=(psi_d^lambda*w_eu_Fin_ca_d^(1-lambda)*skill_shares_eu_ca(1,7)+psi_f^lambda*costfs_eu_Fin_ca^(1-lambda)*(skill_shares_eu_ca(1,8)+skill_shares_eu_ca(1,9)))^(1/(1-lambda));
costh_eu_Fin_ch=(psi_d^lambda*w_eu_Fin_ch_d^(1-lambda)*skill_shares_eu_ch(1,7)+psi_f^lambda*costfs_eu_Fin_ch^(1-lambda)*(skill_shares_eu_ch(1,8)+skill_shares_eu_ch(1,9)))^(1/(1-lambda));

%Canada
costh_ca_IT_ca=(psi_d^lambda*w_ca_IT_ca_d^(1-lambda)*skill_shares_ca_ca(1,1)+psi_f^lambda*w_ca_IT_ca_f^(1-lambda)*skill_shares_ca_ca(1,2))^(1/(1-lambda));
costh_ca_IT_in=(psi_d^lambda*w_ca_IT_in_d^(1-lambda)*skill_shares_ca_in(1,1)+psi_f^lambda*costfs_ca_IT_in^(1-lambda)*(skill_shares_ca_in(1,3)+skill_shares_ca_in(1,2)))^(1/(1-lambda));
costh_ca_IT_eu=(psi_d^lambda*w_ca_IT_eu_d^(1-lambda)*skill_shares_ca_eu(1,1)+psi_f^lambda*costfs_ca_IT_eu^(1-lambda)*(skill_shares_ca_eu(1,3)+skill_shares_ca_eu(1,2)))^(1/(1-lambda));
costh_ca_IT_us=(psi_d^lambda*w_ca_IT_us_d^(1-lambda)*skill_shares_ca_us(1,1)+psi_f^lambda*costfs_ca_IT_us^(1-lambda)*(skill_shares_ca_us(1,3)+skill_shares_ca_us(1,2)))^(1/(1-lambda));
costh_ca_IT_ch=(psi_d^lambda*w_ca_IT_ch_d^(1-lambda)*skill_shares_ca_ch(1,1)+psi_f^lambda*costfs_ca_IT_ch^(1-lambda)*(skill_shares_ca_ch(1,3)+skill_shares_ca_ch(1,2)))^(1/(1-lambda));


costh_ca_Man_ca=(psi_d^lambda*w_ca_Man_ca_d^(1-lambda)*skill_shares_ca_ca(1,3)+psi_f^lambda*w_ca_Man_ca_f^(1-lambda)*skill_shares_ca_ca(1,4))^(1/(1-lambda));
costh_ca_Man_in=(psi_d^lambda*w_ca_Man_in_d^(1-lambda)*skill_shares_ca_in(1,4)+psi_f^lambda*costfs_ca_Man_in^(1-lambda)*(skill_shares_ca_in(1,6)+skill_shares_ca_in(1,5)))^(1/(1-lambda));
costh_ca_Man_eu=(psi_d^lambda*w_ca_Man_eu_d^(1-lambda)*skill_shares_ca_eu(1,4)+psi_f^lambda*costfs_ca_Man_eu^(1-lambda)*(skill_shares_ca_eu(1,6)+skill_shares_ca_eu(1,5)))^(1/(1-lambda));
costh_ca_Man_us=(psi_d^lambda*w_ca_Man_us_d^(1-lambda)*skill_shares_ca_us(1,4)+psi_f^lambda*costfs_ca_Man_us^(1-lambda)*(skill_shares_ca_us(1,6)+skill_shares_ca_us(1,5)))^(1/(1-lambda));
costh_ca_Man_ch=(psi_d^lambda*w_ca_Man_ch_d^(1-lambda)*skill_shares_ca_ch(1,4)+psi_f^lambda*costfs_ca_Man_ch^(1-lambda)*(skill_shares_ca_ch(1,6)+skill_shares_ca_ch(1,5)))^(1/(1-lambda));

costh_ca_Oth_ca=(psi_d^lambda*w_ca_Oth_ca_d^(1-lambda)*skill_shares_ca_ca(1,5)+psi_f^lambda*w_ca_Oth_ca_f^(1-lambda)*skill_shares_ca_ca(1,6))^(1/(1-lambda));

costh_ca_Fin_ca=(psi_d^lambda*w_ca_Fin_ca_d^(1-lambda)*skill_shares_ca_ca(1,7)+psi_f^lambda*w_ca_Fin_ca_f^(1-lambda)*skill_shares_ca_ca(1,8))^(1/(1-lambda));
costh_ca_Fin_in=(psi_d^lambda*w_ca_Fin_in_d^(1-lambda)*skill_shares_ca_in(1,7)+psi_f^lambda*costfs_ca_Fin_in^(1-lambda)*(skill_shares_ca_in(1,8)+skill_shares_ca_in(1,9)))^(1/(1-lambda));
costh_ca_Fin_eu=(psi_d^lambda*w_ca_Fin_eu_d^(1-lambda)*skill_shares_ca_eu(1,7)+psi_f^lambda*costfs_ca_Fin_eu^(1-lambda)*(skill_shares_ca_eu(1,8)+skill_shares_ca_eu(1,9)))^(1/(1-lambda));
costh_ca_Fin_us=(psi_d^lambda*w_ca_Fin_us_d^(1-lambda)*skill_shares_ca_us(1,7)+psi_f^lambda*costfs_ca_Fin_us^(1-lambda)*(skill_shares_ca_us(1,8)+skill_shares_ca_us(1,9)))^(1/(1-lambda));
costh_ca_Fin_ch=(psi_d^lambda*w_ca_Fin_ch_d^(1-lambda)*skill_shares_ca_ch(1,7)+psi_f^lambda*costfs_ca_Fin_ch^(1-lambda)*(skill_shares_ca_ch(1,8)+skill_shares_ca_ch(1,9)))^(1/(1-lambda));



%Unit cost of production

%US


cost_us_IT_us=(p_us_Man_alt^gamma_us_IT_Man)*(p_us_Oth_alt^gamma_us_IT_Oth)*(p_us_Fin_alt^gamma_us_IT_Fin)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,1)+psi_h^epsilon*costh_us_IT_us^(1-epsilon)*broad_share_us(1,2))^(gamma_us_IT_L/(1-epsilon));
cost_us_IT_in=(p_us_Man_alt^gamma_us_IT_Man)*(p_us_Oth_alt^gamma_us_IT_Oth)*(p_us_Fin_alt^gamma_us_IT_Fin)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,3)+psi_h^epsilon*costh_us_IT_in^(1-epsilon)*broad_share_us(1,4))^(gamma_us_IT_L/(1-epsilon));
cost_us_IT_eu=(p_us_Man_alt^gamma_us_IT_Man)*(p_us_Oth_alt^gamma_us_IT_Oth)*(p_us_Fin_alt^gamma_us_IT_Fin)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,5)+psi_h^epsilon*costh_us_IT_eu^(1-epsilon)*broad_share_us(1,6))^(gamma_us_IT_L/(1-epsilon));
cost_us_IT_ca=(p_us_Man_alt^gamma_us_IT_Man)*(p_us_Oth_alt^gamma_us_IT_Oth)*(p_us_Fin_alt^gamma_us_IT_Fin)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,7)+psi_h^epsilon*costh_us_IT_ca^(1-epsilon)*broad_share_us(1,8))^(gamma_us_IT_L/(1-epsilon));
cost_us_IT_ch=(p_us_Man_alt^gamma_us_IT_Man)*(p_us_Oth_alt^gamma_us_IT_Oth)*(p_us_Fin_alt^gamma_us_IT_Fin)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,9)+psi_h^epsilon*costh_us_IT_ch^(1-epsilon)*broad_share_us(1,10))^(gamma_us_IT_L/(1-epsilon));

cost_us_Man_us=(p_us_IT_alt^gamma_us_Man_IT)*(p_us_Oth_alt^gamma_us_Man_Oth)*(p_us_Fin_alt^gamma_us_Man_Fin)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,11)+psi_h^epsilon*costh_us_Man_us^(1-epsilon)*broad_share_us(1,12))^(gamma_us_Man_L/(1-epsilon));
cost_us_Man_in=(p_us_IT_alt^gamma_us_Man_IT)*(p_us_Oth_alt^gamma_us_Man_Oth)*(p_us_Fin_alt^gamma_us_Man_Fin)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,13)+psi_h^epsilon*costh_us_Man_in^(1-epsilon)*broad_share_us(1,14))^(gamma_us_Man_L/(1-epsilon));
cost_us_Man_eu=(p_us_IT_alt^gamma_us_Man_IT)*(p_us_Oth_alt^gamma_us_Man_Oth)*(p_us_Fin_alt^gamma_us_Man_Fin)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,15)+psi_h^epsilon*costh_us_Man_eu^(1-epsilon)*broad_share_us(1,16))^(gamma_us_Man_L/(1-epsilon));
cost_us_Man_ca=(p_us_IT_alt^gamma_us_Man_IT)*(p_us_Oth_alt^gamma_us_Man_Oth)*(p_us_Fin_alt^gamma_us_Man_Fin)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,17)+psi_h^epsilon*costh_us_Man_ca^(1-epsilon)*broad_share_us(1,18))^(gamma_us_Man_L/(1-epsilon));
cost_us_Man_ch=(p_us_IT_alt^gamma_us_Man_IT)*(p_us_Oth_alt^gamma_us_Man_Oth)*(p_us_Fin_alt^gamma_us_Man_Fin)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,19)+psi_h^epsilon*costh_us_Man_ch^(1-epsilon)*broad_share_us(1,20))^(gamma_us_Man_L/(1-epsilon));

cost_us_Oth_us=(p_us_IT_alt^gamma_us_Oth_IT)*(p_us_Man_alt^gamma_us_Oth_Man)*(p_us_Fin_alt^gamma_us_Oth_Fin)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,21)+psi_h^epsilon*costh_us_Oth_us^(1-epsilon)*broad_share_us(1,22))^(gamma_us_Oth_L/(1-epsilon));

cost_us_Fin_us=(p_us_IT_alt^gamma_us_Fin_IT)*(p_us_Man_alt^gamma_us_Fin_Man)*(p_us_Oth_alt^gamma_us_Fin_Oth)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,23)+psi_h^epsilon*costh_us_Fin_us^(1-epsilon)*broad_share_us(1,24))^(gamma_us_Fin_L/(1-epsilon));
cost_us_Fin_in=(p_us_IT_alt^gamma_us_Fin_IT)*(p_us_Man_alt^gamma_us_Fin_Man)*(p_us_Oth_alt^gamma_us_Fin_Oth)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,25)+psi_h^epsilon*costh_us_Fin_in^(1-epsilon)*broad_share_us(1,26))^(gamma_us_Fin_L/(1-epsilon));
cost_us_Fin_eu=(p_us_IT_alt^gamma_us_Fin_IT)*(p_us_Man_alt^gamma_us_Fin_Man)*(p_us_Oth_alt^gamma_us_Fin_Oth)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,27)+psi_h^epsilon*costh_us_Fin_eu^(1-epsilon)*broad_share_us(1,28))^(gamma_us_Fin_L/(1-epsilon));
cost_us_Fin_ca=(p_us_IT_alt^gamma_us_Fin_IT)*(p_us_Man_alt^gamma_us_Fin_Man)*(p_us_Oth_alt^gamma_us_Fin_Oth)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,29)+psi_h^epsilon*costh_us_Fin_ca^(1-epsilon)*broad_share_us(1,30))^(gamma_us_Fin_L/(1-epsilon));
cost_us_Fin_ch=(p_us_IT_alt^gamma_us_Fin_IT)*(p_us_Man_alt^gamma_us_Fin_Man)*(p_us_Oth_alt^gamma_us_Fin_Oth)*(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,31)+psi_h^epsilon*costh_us_Fin_ch^(1-epsilon)*broad_share_us(1,32))^(gamma_us_Fin_L/(1-epsilon));

%Europe

cost_eu_IT_us=(p_eu_Man_alt^gamma_eu_IT_Man)*(p_eu_Oth_alt^gamma_eu_IT_Oth)*(p_eu_Fin_alt^gamma_eu_IT_Fin)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,1)+psi_h^epsilon*costh_eu_IT_us^(1-epsilon)*broad_share_eu(1,2))^(gamma_eu_IT_L/(1-epsilon));
cost_eu_IT_in=(p_eu_Man_alt^gamma_eu_IT_Man)*(p_eu_Oth_alt^gamma_eu_IT_Oth)*(p_eu_Fin_alt^gamma_eu_IT_Fin)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,3)+psi_h^epsilon*costh_eu_IT_in^(1-epsilon)*broad_share_eu(1,4))^(gamma_eu_IT_L/(1-epsilon));
cost_eu_IT_eu=(p_eu_Man_alt^gamma_eu_IT_Man)*(p_eu_Oth_alt^gamma_eu_IT_Oth)*(p_eu_Fin_alt^gamma_eu_IT_Fin)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,5)+psi_h^epsilon*costh_eu_IT_eu^(1-epsilon)*broad_share_eu(1,6))^(gamma_eu_IT_L/(1-epsilon));
cost_eu_IT_ca=(p_eu_Man_alt^gamma_eu_IT_Man)*(p_eu_Oth_alt^gamma_eu_IT_Oth)*(p_eu_Fin_alt^gamma_eu_IT_Fin)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,7)+psi_h^epsilon*costh_eu_IT_ca^(1-epsilon)*broad_share_eu(1,8))^(gamma_eu_IT_L/(1-epsilon));
cost_eu_IT_ch=(p_eu_Man_alt^gamma_eu_IT_Man)*(p_eu_Oth_alt^gamma_eu_IT_Oth)*(p_eu_Fin_alt^gamma_eu_IT_Fin)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,9)+psi_h^epsilon*costh_eu_IT_ch^(1-epsilon)*broad_share_eu(1,10))^(gamma_eu_IT_L/(1-epsilon));

cost_eu_Man_us=(p_eu_IT_alt^gamma_eu_Man_IT)*(p_eu_Oth_alt^gamma_eu_Man_Oth)*(p_eu_Fin_alt^gamma_eu_Man_Fin)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,11)+psi_h^epsilon*costh_eu_Man_us^(1-epsilon)*broad_share_eu(1,12))^(gamma_eu_Man_L/(1-epsilon));
cost_eu_Man_in=(p_eu_IT_alt^gamma_eu_Man_IT)*(p_eu_Oth_alt^gamma_eu_Man_Oth)*(p_eu_Fin_alt^gamma_eu_Man_Fin)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,13)+psi_h^epsilon*costh_eu_Man_in^(1-epsilon)*broad_share_eu(1,14))^(gamma_eu_Man_L/(1-epsilon));
cost_eu_Man_eu=(p_eu_IT_alt^gamma_eu_Man_IT)*(p_eu_Oth_alt^gamma_eu_Man_Oth)*(p_eu_Fin_alt^gamma_eu_Man_Fin)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,15)+psi_h^epsilon*costh_eu_Man_eu^(1-epsilon)*broad_share_eu(1,16))^(gamma_eu_Man_L/(1-epsilon));
cost_eu_Man_ca=(p_eu_IT_alt^gamma_eu_Man_IT)*(p_eu_Oth_alt^gamma_eu_Man_Oth)*(p_eu_Fin_alt^gamma_eu_Man_Fin)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,17)+psi_h^epsilon*costh_eu_Man_ca^(1-epsilon)*broad_share_eu(1,18))^(gamma_eu_Man_L/(1-epsilon));
cost_eu_Man_ch=(p_eu_IT_alt^gamma_eu_Man_IT)*(p_eu_Oth_alt^gamma_eu_Man_Oth)*(p_eu_Fin_alt^gamma_eu_Man_Fin)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,19)+psi_h^epsilon*costh_eu_Man_ch^(1-epsilon)*broad_share_eu(1,20))^(gamma_eu_Man_L/(1-epsilon));

cost_eu_Oth_eu=(p_eu_IT_alt^gamma_eu_Oth_IT)*(p_eu_Man_alt^gamma_eu_Oth_Man)*(p_eu_Fin_alt^gamma_eu_Oth_Fin)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,21)+psi_h^epsilon*costh_eu_Oth_eu^(1-epsilon)*broad_share_eu(1,22))^(gamma_eu_Oth_L/(1-epsilon));

cost_eu_Fin_us=(p_eu_IT_alt^gamma_eu_Fin_IT)*(p_eu_Oth_alt^gamma_eu_Fin_Oth)*(p_eu_Man_alt^gamma_eu_Fin_Man)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,23)+psi_h^epsilon*costh_eu_Fin_us^(1-epsilon)*broad_share_eu(1,24))^(gamma_eu_Fin_L/(1-epsilon));
cost_eu_Fin_in=(p_eu_IT_alt^gamma_eu_Fin_IT)*(p_eu_Oth_alt^gamma_eu_Fin_Oth)*(p_eu_Man_alt^gamma_eu_Fin_Man)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,25)+psi_h^epsilon*costh_eu_Fin_in^(1-epsilon)*broad_share_eu(1,26))^(gamma_eu_Fin_L/(1-epsilon));
cost_eu_Fin_eu=(p_eu_IT_alt^gamma_eu_Fin_IT)*(p_eu_Oth_alt^gamma_eu_Fin_Oth)*(p_eu_Man_alt^gamma_eu_Fin_Man)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,27)+psi_h^epsilon*costh_eu_Fin_eu^(1-epsilon)*broad_share_eu(1,28))^(gamma_eu_Fin_L/(1-epsilon));
cost_eu_Fin_ca=(p_eu_IT_alt^gamma_eu_Fin_IT)*(p_eu_Oth_alt^gamma_eu_Fin_Oth)*(p_eu_Man_alt^gamma_eu_Fin_Man)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,29)+psi_h^epsilon*costh_eu_Fin_ca^(1-epsilon)*broad_share_eu(1,30))^(gamma_eu_Fin_L/(1-epsilon));
cost_eu_Fin_ch=(p_eu_IT_alt^gamma_eu_Fin_IT)*(p_eu_Oth_alt^gamma_eu_Fin_Oth)*(p_eu_Man_alt^gamma_eu_Fin_Man)*(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,31)+psi_h^epsilon*costh_eu_Fin_ch^(1-epsilon)*broad_share_eu(1,32))^(gamma_eu_Fin_L/(1-epsilon));

%Canada

cost_ca_IT_us=(p_ca_Man_alt^gamma_ca_IT_Man)*(p_ca_Oth_alt^gamma_ca_IT_Oth)*(p_ca_Fin_alt^gamma_ca_IT_Fin)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,1)+psi_h^epsilon*costh_ca_IT_us^(1-epsilon)*broad_share_ca(1,2))^(gamma_ca_IT_L/(1-epsilon));
cost_ca_IT_in=(p_ca_Man_alt^gamma_ca_IT_Man)*(p_ca_Oth_alt^gamma_ca_IT_Oth)*(p_ca_Fin_alt^gamma_ca_IT_Fin)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,3)+psi_h^epsilon*costh_ca_IT_in^(1-epsilon)*broad_share_ca(1,4))^(gamma_ca_IT_L/(1-epsilon));
cost_ca_IT_eu=(p_ca_Man_alt^gamma_ca_IT_Man)*(p_ca_Oth_alt^gamma_ca_IT_Oth)*(p_ca_Fin_alt^gamma_ca_IT_Fin)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,5)+psi_h^epsilon*costh_ca_IT_eu^(1-epsilon)*broad_share_ca(1,6))^(gamma_ca_IT_L/(1-epsilon));
cost_ca_IT_ca=(p_ca_Man_alt^gamma_ca_IT_Man)*(p_ca_Oth_alt^gamma_ca_IT_Oth)*(p_ca_Fin_alt^gamma_ca_IT_Fin)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,7)+psi_h^epsilon*costh_ca_IT_ca^(1-epsilon)*broad_share_ca(1,8))^(gamma_ca_IT_L/(1-epsilon));
cost_ca_IT_ch=(p_ca_Man_alt^gamma_ca_IT_Man)*(p_ca_Oth_alt^gamma_ca_IT_Oth)*(p_ca_Fin_alt^gamma_ca_IT_Fin)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,9)+psi_h^epsilon*costh_ca_IT_ch^(1-epsilon)*broad_share_ca(1,10))^(gamma_ca_IT_L/(1-epsilon));

cost_ca_Man_us=(p_ca_IT_alt^gamma_ca_Man_IT)*(p_ca_Oth_alt^gamma_ca_Man_Oth)*(p_ca_Fin_alt^gamma_ca_Man_Fin)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,11)+psi_h^epsilon*costh_ca_Man_us^(1-epsilon)*broad_share_ca(1,12))^(gamma_ca_Man_L/(1-epsilon));
cost_ca_Man_in=(p_ca_IT_alt^gamma_ca_Man_IT)*(p_ca_Oth_alt^gamma_ca_Man_Oth)*(p_ca_Fin_alt^gamma_ca_Man_Fin)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,13)+psi_h^epsilon*costh_ca_Man_in^(1-epsilon)*broad_share_ca(1,14))^(gamma_ca_Man_L/(1-epsilon));
cost_ca_Man_eu=(p_ca_IT_alt^gamma_ca_Man_IT)*(p_ca_Oth_alt^gamma_ca_Man_Oth)*(p_ca_Fin_alt^gamma_ca_Man_Fin)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,15)+psi_h^epsilon*costh_ca_Man_eu^(1-epsilon)*broad_share_ca(1,16))^(gamma_ca_Man_L/(1-epsilon));
cost_ca_Man_ca=(p_ca_IT_alt^gamma_ca_Man_IT)*(p_ca_Oth_alt^gamma_ca_Man_Oth)*(p_ca_Fin_alt^gamma_ca_Man_Fin)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,17)+psi_h^epsilon*costh_ca_Man_ca^(1-epsilon)*broad_share_ca(1,18))^(gamma_ca_Man_L/(1-epsilon));
cost_ca_Man_ch=(p_ca_IT_alt^gamma_ca_Man_IT)*(p_ca_Oth_alt^gamma_ca_Man_Oth)*(p_ca_Fin_alt^gamma_ca_Man_Fin)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,19)+psi_h^epsilon*costh_ca_Man_ch^(1-epsilon)*broad_share_ca(1,20))^(gamma_ca_Man_L/(1-epsilon));

cost_ca_Oth_ca=(p_ca_IT_alt^gamma_ca_Oth_IT)*(p_ca_Man_alt^gamma_ca_Oth_Man)*(p_ca_Fin_alt^gamma_ca_Oth_Fin)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,21)+psi_h^epsilon*costh_ca_Oth_ca^(1-epsilon)*broad_share_ca(1,22))^(gamma_ca_Oth_L/(1-epsilon));

cost_ca_Fin_us=(p_ca_IT_alt^gamma_ca_Fin_IT)*(p_ca_Oth_alt^gamma_ca_Fin_Oth)*(p_ca_Man_alt^gamma_ca_Fin_Man)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,23)+psi_h^epsilon*costh_ca_Fin_us^(1-epsilon)*broad_share_ca(1,24))^(gamma_ca_Fin_L/(1-epsilon));
cost_ca_Fin_in=(p_ca_IT_alt^gamma_ca_Fin_IT)*(p_ca_Oth_alt^gamma_ca_Fin_Oth)*(p_ca_Man_alt^gamma_ca_Fin_Man)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,25)+psi_h^epsilon*costh_ca_Fin_in^(1-epsilon)*broad_share_ca(1,26))^(gamma_ca_Fin_L/(1-epsilon));
cost_ca_Fin_eu=(p_ca_IT_alt^gamma_ca_Fin_IT)*(p_ca_Oth_alt^gamma_ca_Fin_Oth)*(p_ca_Man_alt^gamma_ca_Fin_Man)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,27)+psi_h^epsilon*costh_ca_Fin_eu^(1-epsilon)*broad_share_ca(1,28))^(gamma_ca_Fin_L/(1-epsilon));
cost_ca_Fin_ca=(p_ca_IT_alt^gamma_ca_Fin_IT)*(p_ca_Oth_alt^gamma_ca_Fin_Oth)*(p_ca_Man_alt^gamma_ca_Fin_Man)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,29)+psi_h^epsilon*costh_ca_Fin_ca^(1-epsilon)*broad_share_ca(1,30))^(gamma_ca_Fin_L/(1-epsilon));
cost_ca_Fin_ch=(p_ca_IT_alt^gamma_ca_Fin_IT)*(p_ca_Oth_alt^gamma_ca_Fin_Oth)*(p_ca_Man_alt^gamma_ca_Fin_Man)*(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,31)+psi_h^epsilon*costh_ca_Fin_ch^(1-epsilon)*broad_share_ca(1,32))^(gamma_ca_Fin_L/(1-epsilon));


%India

cost_in_IT_us=(p_in_Man_alt^gamma_in_IT_Man)*(p_in_Oth_alt^gamma_in_IT_Oth)*(p_in_Fin_alt^gamma_in_IT_Fin)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,1)+psi_h^epsilon*w_in_IT_us^(1-epsilon)*broad_share_in(1,2))^(gamma_in_IT_L/(1-epsilon));
cost_in_IT_in=(p_in_Man_alt^gamma_in_IT_Man)*(p_in_Oth_alt^gamma_in_IT_Oth)*(p_in_Fin_alt^gamma_in_IT_Fin)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,3)+psi_h^epsilon*w_in_IT_in^(1-epsilon)*broad_share_in(1,4))^(gamma_in_IT_L/(1-epsilon));
cost_in_IT_eu=(p_in_Man_alt^gamma_in_IT_Man)*(p_in_Oth_alt^gamma_in_IT_Oth)*(p_in_Fin_alt^gamma_in_IT_Fin)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,5)+psi_h^epsilon*w_in_IT_eu^(1-epsilon)*broad_share_in(1,6))^(gamma_in_IT_L/(1-epsilon));
cost_in_IT_ca=(p_in_Man_alt^gamma_in_IT_Man)*(p_in_Oth_alt^gamma_in_IT_Oth)*(p_in_Fin_alt^gamma_in_IT_Fin)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,7)+psi_h^epsilon*w_in_IT_ca^(1-epsilon)*broad_share_in(1,8))^(gamma_in_IT_L/(1-epsilon));
cost_in_IT_ch=(p_in_Man_alt^gamma_in_IT_Man)*(p_in_Oth_alt^gamma_in_IT_Oth)*(p_in_Fin_alt^gamma_in_IT_Fin)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,9)+psi_h^epsilon*w_in_IT_ch^(1-epsilon)*broad_share_in(1,10))^(gamma_in_IT_L/(1-epsilon));

cost_in_Man_us=(p_in_IT_alt^gamma_in_Man_IT)*(p_in_Oth_alt^gamma_in_Man_Oth)*(p_in_Fin_alt^gamma_in_Man_Fin)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,11)+psi_h^epsilon*w_in_Man_us^(1-epsilon)*broad_share_in(1,12))^(gamma_in_Man_L/(1-epsilon));
cost_in_Man_in=(p_in_IT_alt^gamma_in_Man_IT)*(p_in_Oth_alt^gamma_in_Man_Oth)*(p_in_Fin_alt^gamma_in_Man_Fin)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,13)+psi_h^epsilon*w_in_Man_in^(1-epsilon)*broad_share_in(1,14))^(gamma_in_Man_L/(1-epsilon));
cost_in_Man_eu=(p_in_IT_alt^gamma_in_Man_IT)*(p_in_Oth_alt^gamma_in_Man_Oth)*(p_in_Fin_alt^gamma_in_Man_Fin)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,15)+psi_h^epsilon*w_in_Man_eu^(1-epsilon)*broad_share_in(1,16))^(gamma_in_Man_L/(1-epsilon));
cost_in_Man_ca=(p_in_IT_alt^gamma_in_Man_IT)*(p_in_Oth_alt^gamma_in_Man_Oth)*(p_in_Fin_alt^gamma_in_Man_Fin)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,17)+psi_h^epsilon*w_in_Man_ca^(1-epsilon)*broad_share_in(1,18))^(gamma_in_Man_L/(1-epsilon));
cost_in_Man_ch=(p_in_IT_alt^gamma_in_Man_IT)*(p_in_Oth_alt^gamma_in_Man_Oth)*(p_in_Fin_alt^gamma_in_Man_Fin)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,19)+psi_h^epsilon*w_in_Man_ch^(1-epsilon)*broad_share_in(1,20))^(gamma_in_Man_L/(1-epsilon));

cost_in_Oth_in=(p_in_IT_alt^gamma_in_Oth_IT)*(p_in_Man_alt^gamma_in_Oth_Man)*(p_in_Fin_alt^gamma_in_Oth_Fin)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,21)+psi_h^epsilon*w_in_Oth_in^(1-epsilon)*broad_share_in(1,22))^(gamma_in_Oth_L/(1-epsilon));

cost_in_Fin_us=(p_in_IT_alt^gamma_in_Fin_IT)*(p_in_Oth_alt^gamma_in_Fin_Oth)*(p_in_Man_alt^gamma_in_Fin_Man)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,23)+psi_h^epsilon*w_in_Fin_us^(1-epsilon)*broad_share_in(1,24))^(gamma_in_Fin_L/(1-epsilon));
cost_in_Fin_in=(p_in_IT_alt^gamma_in_Fin_IT)*(p_in_Oth_alt^gamma_in_Fin_Oth)*(p_in_Man_alt^gamma_in_Fin_Man)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,25)+psi_h^epsilon*w_in_Fin_in^(1-epsilon)*broad_share_in(1,26))^(gamma_in_Fin_L/(1-epsilon));
cost_in_Fin_eu=(p_in_IT_alt^gamma_in_Fin_IT)*(p_in_Oth_alt^gamma_in_Fin_Oth)*(p_in_Man_alt^gamma_in_Fin_Man)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,27)+psi_h^epsilon*w_in_Fin_eu^(1-epsilon)*broad_share_in(1,28))^(gamma_in_Fin_L/(1-epsilon));
cost_in_Fin_ca=(p_in_IT_alt^gamma_in_Fin_IT)*(p_in_Oth_alt^gamma_in_Fin_Oth)*(p_in_Man_alt^gamma_in_Fin_Man)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,29)+psi_h^epsilon*w_in_Fin_ca^(1-epsilon)*broad_share_in(1,30))^(gamma_in_Fin_L/(1-epsilon));
cost_in_Fin_ch=(p_in_IT_alt^gamma_in_Fin_IT)*(p_in_Oth_alt^gamma_in_Fin_Oth)*(p_in_Man_alt^gamma_in_Fin_Man)*(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,31)+psi_h^epsilon*w_in_Fin_ch^(1-epsilon)*broad_share_in(1,32))^(gamma_in_Fin_L/(1-epsilon));


%China

cost_ch_IT_us=(p_ch_Man_alt^gamma_ch_IT_Man)*(p_ch_Oth_alt^gamma_ch_IT_Oth)*(p_ch_Fin_alt^gamma_ch_IT_Fin)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,1)+psi_h^epsilon*w_ch_IT_us^(1-epsilon)*broad_share_ch(1,2))^(gamma_ch_IT_L/(1-epsilon));
cost_ch_IT_in=(p_ch_Man_alt^gamma_ch_IT_Man)*(p_ch_Oth_alt^gamma_ch_IT_Oth)*(p_ch_Fin_alt^gamma_ch_IT_Fin)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,3)+psi_h^epsilon*w_ch_IT_in^(1-epsilon)*broad_share_ch(1,4))^(gamma_ch_IT_L/(1-epsilon));
cost_ch_IT_eu=(p_ch_Man_alt^gamma_ch_IT_Man)*(p_ch_Oth_alt^gamma_ch_IT_Oth)*(p_ch_Fin_alt^gamma_ch_IT_Fin)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,5)+psi_h^epsilon*w_ch_IT_eu^(1-epsilon)*broad_share_ch(1,6))^(gamma_ch_IT_L/(1-epsilon));
cost_ch_IT_ca=(p_ch_Man_alt^gamma_ch_IT_Man)*(p_ch_Oth_alt^gamma_ch_IT_Oth)*(p_ch_Fin_alt^gamma_ch_IT_Fin)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,7)+psi_h^epsilon*w_ch_IT_ca^(1-epsilon)*broad_share_ch(1,8))^(gamma_ch_IT_L/(1-epsilon));
cost_ch_IT_ch=(p_ch_Man_alt^gamma_ch_IT_Man)*(p_ch_Oth_alt^gamma_ch_IT_Oth)*(p_ch_Fin_alt^gamma_ch_IT_Fin)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,9)+psi_h^epsilon*w_ch_IT_ch^(1-epsilon)*broad_share_ch(1,10))^(gamma_ch_IT_L/(1-epsilon));

cost_ch_Man_us=(p_ch_IT_alt^gamma_ch_Man_IT)*(p_ch_Oth_alt^gamma_ch_Man_Oth)*(p_ch_Fin_alt^gamma_ch_Man_Fin)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,11)+psi_h^epsilon*w_ch_Man_us^(1-epsilon)*broad_share_ch(1,12))^(gamma_ch_Man_L/(1-epsilon));
cost_ch_Man_in=(p_ch_IT_alt^gamma_ch_Man_IT)*(p_ch_Oth_alt^gamma_ch_Man_Oth)*(p_ch_Fin_alt^gamma_ch_Man_Fin)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,13)+psi_h^epsilon*w_ch_Man_in^(1-epsilon)*broad_share_ch(1,14))^(gamma_ch_Man_L/(1-epsilon));
cost_ch_Man_eu=(p_ch_IT_alt^gamma_ch_Man_IT)*(p_ch_Oth_alt^gamma_ch_Man_Oth)*(p_ch_Fin_alt^gamma_ch_Man_Fin)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,15)+psi_h^epsilon*w_ch_Man_eu^(1-epsilon)*broad_share_ch(1,16))^(gamma_ch_Man_L/(1-epsilon));
cost_ch_Man_ca=(p_ch_IT_alt^gamma_ch_Man_IT)*(p_ch_Oth_alt^gamma_ch_Man_Oth)*(p_ch_Fin_alt^gamma_ch_Man_Fin)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,17)+psi_h^epsilon*w_ch_Man_ca^(1-epsilon)*broad_share_ch(1,18))^(gamma_ch_Man_L/(1-epsilon));
cost_ch_Man_ch=(p_ch_IT_alt^gamma_ch_Man_IT)*(p_ch_Oth_alt^gamma_ch_Man_Oth)*(p_ch_Fin_alt^gamma_ch_Man_Fin)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,19)+psi_h^epsilon*w_ch_Man_ch^(1-epsilon)*broad_share_ch(1,20))^(gamma_ch_Man_L/(1-epsilon));

cost_ch_Oth_ch=(p_ch_IT_alt^gamma_ch_Oth_IT)*(p_ch_Man_alt^gamma_ch_Oth_Man)*(p_ch_Fin_alt^gamma_ch_Oth_Fin)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,21)+psi_h^epsilon*w_ch_Oth_ch^(1-epsilon)*broad_share_ch(1,22))^(gamma_ch_Oth_L/(1-epsilon));

cost_ch_Fin_us=(p_ch_IT_alt^gamma_ch_Fin_IT)*(p_ch_Oth_alt^gamma_ch_Fin_Oth)*(p_ch_Man_alt^gamma_ch_Fin_Man)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,23)+psi_h^epsilon*w_ch_Fin_us^(1-epsilon)*broad_share_ch(1,24))^(gamma_ch_Fin_L/(1-epsilon));
cost_ch_Fin_in=(p_ch_IT_alt^gamma_ch_Fin_IT)*(p_ch_Oth_alt^gamma_ch_Fin_Oth)*(p_ch_Man_alt^gamma_ch_Fin_Man)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,25)+psi_h^epsilon*w_ch_Fin_in^(1-epsilon)*broad_share_ch(1,26))^(gamma_ch_Fin_L/(1-epsilon));
cost_ch_Fin_eu=(p_ch_IT_alt^gamma_ch_Fin_IT)*(p_ch_Oth_alt^gamma_ch_Fin_Oth)*(p_ch_Man_alt^gamma_ch_Fin_Man)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,27)+psi_h^epsilon*w_ch_Fin_eu^(1-epsilon)*broad_share_ch(1,28))^(gamma_ch_Fin_L/(1-epsilon));
cost_ch_Fin_ca=(p_ch_IT_alt^gamma_ch_Fin_IT)*(p_ch_Oth_alt^gamma_ch_Fin_Oth)*(p_ch_Man_alt^gamma_ch_Fin_Man)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,29)+psi_h^epsilon*w_ch_Fin_ca^(1-epsilon)*broad_share_ch(1,30))^(gamma_ch_Fin_L/(1-epsilon));
cost_ch_Fin_ch=(p_ch_IT_alt^gamma_ch_Fin_IT)*(p_ch_Oth_alt^gamma_ch_Fin_Oth)*(p_ch_Man_alt^gamma_ch_Fin_Man)*(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,31)+psi_h^epsilon*w_ch_Fin_ch^(1-epsilon)*broad_share_ch(1,32))^(gamma_ch_Fin_L/(1-epsilon));


%Other
cost_ot_IT_ot=(p_ot_Man_alt^gamma_ot_IT_Man)*(p_ot_Oth_alt^gamma_ot_IT_Oth)*(p_ot_Fin_alt^gamma_ot_IT_Fin)*(psi_l^epsilon*w_ot_L^(1-epsilon)*broad_share_ot(1,1)+psi_h^epsilon*w_ot_IT_ot^(1-epsilon)*broad_share_ot(1,2))^(gamma_ot_IT_L/(1-epsilon));
cost_ot_Man_ot=(p_ot_IT_alt^gamma_ot_Man_IT)*(p_ot_Oth_alt^gamma_ot_Man_Oth)*(p_ot_Fin_alt^gamma_ot_Man_Fin)*(psi_l^epsilon*w_ot_L^(1-epsilon)*broad_share_ot(1,3)+psi_h^epsilon*w_ot_Man_ot^(1-epsilon)*broad_share_ot(1,4))^(gamma_ot_Man_L/(1-epsilon));
cost_ot_Oth_ot=(p_ot_IT_alt^gamma_ot_Oth_IT)*(p_ot_Man_alt^gamma_ot_Oth_Man)*(p_ot_Fin_alt^gamma_ot_Oth_Fin)*(psi_l^epsilon*w_ot_L^(1-epsilon)*broad_share_ot(1,5)+psi_h^epsilon*w_ot_Oth_ot^(1-epsilon)*broad_share_ot(1,6))^(gamma_ot_Oth_L/(1-epsilon));
cost_ot_Fin_ot=(p_ot_IT_alt^gamma_ot_Fin_IT)*(p_ot_Man_alt^gamma_ot_Fin_Man)*(p_ot_Oth_alt^gamma_ot_Fin_Oth)*(psi_l^epsilon*w_ot_L^(1-epsilon)*broad_share_ot(1,7)+psi_h^epsilon*w_ot_Fin_ot^(1-epsilon)*broad_share_ot(1,8))^(gamma_ot_Fin_L/(1-epsilon));


%Broad Low-High Skill Share

%US
lowshare_us_IT_us=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,1)+psi_h^epsilon*costh_us_IT_us^(1-epsilon)*broad_share_us(1,2));
highshare_us_IT_us=(psi_h^epsilon*costh_us_IT_us^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,1)+psi_h^epsilon*costh_us_IT_us^(1-epsilon)*broad_share_us(1,2));

lowshare_us_IT_in=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,3)+psi_h^epsilon*costh_us_IT_in^(1-epsilon)*broad_share_us(1,4));
highshare_us_IT_in=(psi_h^epsilon*costh_us_IT_in^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,3)+psi_h^epsilon*costh_us_IT_in^(1-epsilon)*broad_share_us(1,4));

lowshare_us_IT_eu=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,5)+psi_h^epsilon*costh_us_IT_eu^(1-epsilon)*broad_share_us(1,6));
highshare_us_IT_eu=(psi_h^epsilon*costh_us_IT_eu^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,5)+psi_h^epsilon*costh_us_IT_eu^(1-epsilon)*broad_share_us(1,6));

lowshare_us_IT_ca=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,7)+psi_h^epsilon*costh_us_IT_ca^(1-epsilon)*broad_share_us(1,8));
highshare_us_IT_ca=(psi_h^epsilon*costh_us_IT_ca^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,7)+psi_h^epsilon*costh_us_IT_ca^(1-epsilon)*broad_share_us(1,8));

lowshare_us_IT_ch=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,9)+psi_h^epsilon*costh_us_IT_ch^(1-epsilon)*broad_share_us(1,10));
highshare_us_IT_ch=(psi_h^epsilon*costh_us_IT_ch^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,9)+psi_h^epsilon*costh_us_IT_ch^(1-epsilon)*broad_share_us(1,10));

lowshare_us_Man_us=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,11)+psi_h^epsilon*costh_us_Man_us^(1-epsilon)*broad_share_us(1,12));
highshare_us_Man_us=(psi_h^epsilon*costh_us_Man_us^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,11)+psi_h^epsilon*costh_us_Man_us^(1-epsilon)*broad_share_us(1,12));

lowshare_us_Man_in=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,13)+psi_h^epsilon*costh_us_Man_in^(1-epsilon)*broad_share_us(1,14));
highshare_us_Man_in=(psi_h^epsilon*costh_us_Man_in^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,13)+psi_h^epsilon*costh_us_Man_in^(1-epsilon)*broad_share_us(1,14));

lowshare_us_Man_eu=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,15)+psi_h^epsilon*costh_us_Man_eu^(1-epsilon)*broad_share_us(1,16));
highshare_us_Man_eu=(psi_h^epsilon*costh_us_Man_eu^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,15)+psi_h^epsilon*costh_us_Man_eu^(1-epsilon)*broad_share_us(1,16));

lowshare_us_Man_ca=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,17)+psi_h^epsilon*costh_us_Man_ca^(1-epsilon)*broad_share_us(1,18));
highshare_us_Man_ca=(psi_h^epsilon*costh_us_Man_ca^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,17)+psi_h^epsilon*costh_us_Man_ca^(1-epsilon)*broad_share_us(1,18));

lowshare_us_Man_ch=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,19)+psi_h^epsilon*costh_us_Man_ch^(1-epsilon)*broad_share_us(1,20));
highshare_us_Man_ch=(psi_h^epsilon*costh_us_Man_ch^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,19)+psi_h^epsilon*costh_us_Man_ch^(1-epsilon)*broad_share_us(1,20));

lowshare_us_Oth_us=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,21)+psi_h^epsilon*costh_us_Oth_us^(1-epsilon)*broad_share_us(1,22));
highshare_us_Oth_us=(psi_h^epsilon*costh_us_Oth_us^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,21)+psi_h^epsilon*costh_us_Oth_us^(1-epsilon)*broad_share_us(1,22));


lowshare_us_Fin_us=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,23)+psi_h^epsilon*costh_us_Fin_us^(1-epsilon)*broad_share_us(1,24));
highshare_us_Fin_us=(psi_h^epsilon*costh_us_Fin_us^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,23)+psi_h^epsilon*costh_us_Fin_us^(1-epsilon)*broad_share_us(1,24));

lowshare_us_Fin_in=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,25)+psi_h^epsilon*costh_us_Fin_in^(1-epsilon)*broad_share_us(1,26));
highshare_us_Fin_in=(psi_h^epsilon*costh_us_Fin_in^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,25)+psi_h^epsilon*costh_us_Fin_in^(1-epsilon)*broad_share_us(1,26));

lowshare_us_Fin_eu=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,27)+psi_h^epsilon*costh_us_Fin_eu^(1-epsilon)*broad_share_us(1,28));
highshare_us_Fin_eu=(psi_h^epsilon*costh_us_Fin_eu^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,27)+psi_h^epsilon*costh_us_Fin_eu^(1-epsilon)*broad_share_us(1,28));

lowshare_us_Fin_ca=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,29)+psi_h^epsilon*costh_us_Fin_ca^(1-epsilon)*broad_share_us(1,30));
highshare_us_Fin_ca=(psi_h^epsilon*costh_us_Fin_ca^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,29)+psi_h^epsilon*costh_us_Fin_ca^(1-epsilon)*broad_share_us(1,30));

lowshare_us_Fin_ch=(psi_l^epsilon*w_us_L^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,31)+psi_h^epsilon*costh_us_Fin_ch^(1-epsilon)*broad_share_us(1,32));
highshare_us_Fin_ch=(psi_h^epsilon*costh_us_Fin_ch^(1-epsilon))/(psi_l^epsilon*w_us_L^(1-epsilon)*broad_share_us(1,31)+psi_h^epsilon*costh_us_Fin_ch^(1-epsilon)*broad_share_us(1,32));

%Europe

lowshare_eu_IT_us=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,1)+psi_h^epsilon*costh_eu_IT_us^(1-epsilon)*broad_share_eu(1,2));
highshare_eu_IT_us=(psi_h^epsilon*costh_eu_IT_us^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,1)+psi_h^epsilon*costh_eu_IT_us^(1-epsilon)*broad_share_eu(1,2));

lowshare_eu_IT_in=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,3)+psi_h^epsilon*costh_eu_IT_in^(1-epsilon)*broad_share_eu(1,4));
highshare_eu_IT_in=(psi_h^epsilon*costh_eu_IT_in^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,3)+psi_h^epsilon*costh_eu_IT_in^(1-epsilon)*broad_share_eu(1,4));

lowshare_eu_IT_eu=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,5)+psi_h^epsilon*costh_eu_IT_eu^(1-epsilon)*broad_share_eu(1,6));
highshare_eu_IT_eu=(psi_h^epsilon*costh_eu_IT_eu^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,5)+psi_h^epsilon*costh_eu_IT_eu^(1-epsilon)*broad_share_eu(1,6));

lowshare_eu_IT_ca=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,7)+psi_h^epsilon*costh_eu_IT_ca^(1-epsilon)*broad_share_eu(1,8));
highshare_eu_IT_ca=(psi_h^epsilon*costh_eu_IT_ca^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,7)+psi_h^epsilon*costh_eu_IT_ca^(1-epsilon)*broad_share_eu(1,8));

lowshare_eu_IT_ch=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,9)+psi_h^epsilon*costh_eu_IT_ch^(1-epsilon)*broad_share_eu(1,10));
highshare_eu_IT_ch=(psi_h^epsilon*costh_eu_IT_ch^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,9)+psi_h^epsilon*costh_eu_IT_ch^(1-epsilon)*broad_share_eu(1,10));

lowshare_eu_Man_us=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,11)+psi_h^epsilon*costh_eu_Man_us^(1-epsilon)*broad_share_eu(1,12));
highshare_eu_Man_us=(psi_h^epsilon*costh_eu_Man_us^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,11)+psi_h^epsilon*costh_eu_Man_us^(1-epsilon)*broad_share_eu(1,12));

lowshare_eu_Man_in=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,13)+psi_h^epsilon*costh_eu_Man_in^(1-epsilon)*broad_share_eu(1,14));
highshare_eu_Man_in=(psi_h^epsilon*costh_eu_Man_in^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,13)+psi_h^epsilon*costh_eu_Man_in^(1-epsilon)*broad_share_eu(1,14));

lowshare_eu_Man_eu=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,15)+psi_h^epsilon*costh_eu_Man_eu^(1-epsilon)*broad_share_eu(1,16));
highshare_eu_Man_eu=(psi_h^epsilon*costh_eu_Man_eu^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,15)+psi_h^epsilon*costh_eu_Man_eu^(1-epsilon)*broad_share_eu(1,16));

lowshare_eu_Man_ca=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,17)+psi_h^epsilon*costh_eu_Man_ca^(1-epsilon)*broad_share_eu(1,18));
highshare_eu_Man_ca=(psi_h^epsilon*costh_eu_Man_ca^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,17)+psi_h^epsilon*costh_eu_Man_ca^(1-epsilon)*broad_share_eu(1,18));

lowshare_eu_Man_ch=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,19)+psi_h^epsilon*costh_eu_Man_ch^(1-epsilon)*broad_share_eu(1,20));
highshare_eu_Man_ch=(psi_h^epsilon*costh_eu_Man_ch^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,19)+psi_h^epsilon*costh_eu_Man_ch^(1-epsilon)*broad_share_eu(1,20));

lowshare_eu_Oth_eu=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,21)+psi_h^epsilon*costh_eu_Oth_eu^(1-epsilon)*broad_share_eu(1,22));
highshare_eu_Oth_eu=(psi_h^epsilon*costh_eu_Oth_eu^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,21)+psi_h^epsilon*costh_eu_Oth_eu^(1-epsilon)*broad_share_eu(1,22));


lowshare_eu_Fin_us=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,23)+psi_h^epsilon*costh_eu_Fin_us^(1-epsilon)*broad_share_eu(1,24));
highshare_eu_Fin_us=(psi_h^epsilon*costh_eu_Fin_us^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,23)+psi_h^epsilon*costh_eu_Fin_us^(1-epsilon)*broad_share_eu(1,24));

lowshare_eu_Fin_in=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,25)+psi_h^epsilon*costh_eu_Fin_in^(1-epsilon)*broad_share_eu(1,26));
highshare_eu_Fin_in=(psi_h^epsilon*costh_eu_Fin_in^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,25)+psi_h^epsilon*costh_eu_Fin_in^(1-epsilon)*broad_share_eu(1,26));

lowshare_eu_Fin_eu=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,27)+psi_h^epsilon*costh_eu_Fin_eu^(1-epsilon)*broad_share_eu(1,28));
highshare_eu_Fin_eu=(psi_h^epsilon*costh_eu_Fin_eu^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,27)+psi_h^epsilon*costh_eu_Fin_eu^(1-epsilon)*broad_share_eu(1,28));

lowshare_eu_Fin_ca=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,29)+psi_h^epsilon*costh_eu_Fin_ca^(1-epsilon)*broad_share_eu(1,30));
highshare_eu_Fin_ca=(psi_h^epsilon*costh_eu_Fin_ca^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,29)+psi_h^epsilon*costh_eu_Fin_ca^(1-epsilon)*broad_share_eu(1,30));

lowshare_eu_Fin_ch=(psi_l^epsilon*w_eu_L^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,31)+psi_h^epsilon*costh_eu_Fin_ch^(1-epsilon)*broad_share_eu(1,32));
highshare_eu_Fin_ch=(psi_h^epsilon*costh_eu_Fin_ch^(1-epsilon))/(psi_l^epsilon*w_eu_L^(1-epsilon)*broad_share_eu(1,31)+psi_h^epsilon*costh_eu_Fin_ch^(1-epsilon)*broad_share_eu(1,32));




%Canada


lowshare_ca_IT_us=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,1)+psi_h^epsilon*costh_ca_IT_us^(1-epsilon)*broad_share_ca(1,2));
highshare_ca_IT_us=(psi_h^epsilon*costh_ca_IT_us^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,1)+psi_h^epsilon*costh_ca_IT_us^(1-epsilon)*broad_share_ca(1,2));

lowshare_ca_IT_in=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,3)+psi_h^epsilon*costh_ca_IT_in^(1-epsilon)*broad_share_ca(1,4));
highshare_ca_IT_in=(psi_h^epsilon*costh_ca_IT_in^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,3)+psi_h^epsilon*costh_ca_IT_in^(1-epsilon)*broad_share_ca(1,4));

lowshare_ca_IT_eu=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,5)+psi_h^epsilon*costh_ca_IT_eu^(1-epsilon)*broad_share_ca(1,6));
highshare_ca_IT_eu=(psi_h^epsilon*costh_ca_IT_eu^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,5)+psi_h^epsilon*costh_ca_IT_eu^(1-epsilon)*broad_share_ca(1,6));

lowshare_ca_IT_ca=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,7)+psi_h^epsilon*costh_ca_IT_ca^(1-epsilon)*broad_share_ca(1,8));
highshare_ca_IT_ca=(psi_h^epsilon*costh_ca_IT_ca^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,7)+psi_h^epsilon*costh_ca_IT_ca^(1-epsilon)*broad_share_ca(1,8));

lowshare_ca_IT_ch=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,9)+psi_h^epsilon*costh_ca_IT_ch^(1-epsilon)*broad_share_ca(1,10));
highshare_ca_IT_ch=(psi_h^epsilon*costh_ca_IT_ch^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,9)+psi_h^epsilon*costh_ca_IT_ch^(1-epsilon)*broad_share_ca(1,10));

lowshare_ca_Man_us=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,11)+psi_h^epsilon*costh_ca_Man_us^(1-epsilon)*broad_share_ca(1,12));
highshare_ca_Man_us=(psi_h^epsilon*costh_ca_Man_us^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,11)+psi_h^epsilon*costh_ca_Man_us^(1-epsilon)*broad_share_ca(1,12));

lowshare_ca_Man_in=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,13)+psi_h^epsilon*costh_ca_Man_in^(1-epsilon)*broad_share_ca(1,14));
highshare_ca_Man_in=(psi_h^epsilon*costh_ca_Man_in^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,13)+psi_h^epsilon*costh_ca_Man_in^(1-epsilon)*broad_share_ca(1,14));

lowshare_ca_Man_eu=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,15)+psi_h^epsilon*costh_ca_Man_eu^(1-epsilon)*broad_share_ca(1,16));
highshare_ca_Man_eu=(psi_h^epsilon*costh_ca_Man_eu^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,15)+psi_h^epsilon*costh_ca_Man_eu^(1-epsilon)*broad_share_ca(1,16));

lowshare_ca_Man_ca=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,17)+psi_h^epsilon*costh_ca_Man_ca^(1-epsilon)*broad_share_ca(1,18));
highshare_ca_Man_ca=(psi_h^epsilon*costh_ca_Man_ca^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,17)+psi_h^epsilon*costh_ca_Man_ca^(1-epsilon)*broad_share_ca(1,18));

lowshare_ca_Man_ch=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,19)+psi_h^epsilon*costh_ca_Man_ch^(1-epsilon)*broad_share_ca(1,20));
highshare_ca_Man_ch=(psi_h^epsilon*costh_ca_Man_ch^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,19)+psi_h^epsilon*costh_ca_Man_ch^(1-epsilon)*broad_share_ca(1,20));

lowshare_ca_Oth_ca=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,21)+psi_h^epsilon*costh_ca_Oth_ca^(1-epsilon)*broad_share_ca(1,22));
highshare_ca_Oth_ca=(psi_h^epsilon*costh_ca_Oth_ca^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,21)+psi_h^epsilon*costh_ca_Oth_ca^(1-epsilon)*broad_share_ca(1,22));

lowshare_ca_Fin_us=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,23)+psi_h^epsilon*costh_ca_Fin_us^(1-epsilon)*broad_share_ca(1,24));
highshare_ca_Fin_us=(psi_h^epsilon*costh_ca_Fin_us^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,23)+psi_h^epsilon*costh_ca_Fin_us^(1-epsilon)*broad_share_ca(1,24));

lowshare_ca_Fin_in=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,25)+psi_h^epsilon*costh_ca_Fin_in^(1-epsilon)*broad_share_ca(1,26));
highshare_ca_Fin_in=(psi_h^epsilon*costh_ca_Fin_in^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,25)+psi_h^epsilon*costh_ca_Fin_in^(1-epsilon)*broad_share_ca(1,26));

lowshare_ca_Fin_eu=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,27)+psi_h^epsilon*costh_ca_Fin_eu^(1-epsilon)*broad_share_ca(1,28));
highshare_ca_Fin_eu=(psi_h^epsilon*costh_ca_Fin_eu^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,27)+psi_h^epsilon*costh_ca_Fin_eu^(1-epsilon)*broad_share_ca(1,28));

lowshare_ca_Fin_ca=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,29)+psi_h^epsilon*costh_ca_Fin_ca^(1-epsilon)*broad_share_ca(1,30));
highshare_ca_Fin_ca=(psi_h^epsilon*costh_ca_Fin_ca^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,29)+psi_h^epsilon*costh_ca_Fin_ca^(1-epsilon)*broad_share_ca(1,30));

lowshare_ca_Fin_ch=(psi_l^epsilon*w_ca_L^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,31)+psi_h^epsilon*costh_ca_Fin_ch^(1-epsilon)*broad_share_ca(1,32));
highshare_ca_Fin_ch=(psi_h^epsilon*costh_ca_Fin_ch^(1-epsilon))/(psi_l^epsilon*w_ca_L^(1-epsilon)*broad_share_ca(1,31)+psi_h^epsilon*costh_ca_Fin_ch^(1-epsilon)*broad_share_ca(1,32));


%India

lowshare_in_IT_us=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,1)+psi_h^epsilon*cost_in_IT_us^(1-epsilon)*broad_share_in(1,2));
highshare_in_IT_us=(psi_h^epsilon*cost_in_IT_us^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,1)+psi_h^epsilon*cost_in_IT_us^(1-epsilon)*broad_share_in(1,2));

lowshare_in_IT_in=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,3)+psi_h^epsilon*cost_in_IT_in^(1-epsilon)*broad_share_in(1,4));
highshare_in_IT_in=(psi_h^epsilon*cost_in_IT_in^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,3)+psi_h^epsilon*cost_in_IT_in^(1-epsilon)*broad_share_in(1,4));

lowshare_in_IT_eu=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,5)+psi_h^epsilon*cost_in_IT_eu^(1-epsilon)*broad_share_in(1,6));
highshare_in_IT_eu=(psi_h^epsilon*cost_in_IT_eu^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,5)+psi_h^epsilon*cost_in_IT_eu^(1-epsilon)*broad_share_in(1,6));

lowshare_in_IT_ca=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,7)+psi_h^epsilon*cost_in_IT_ca^(1-epsilon)*broad_share_in(1,8));
highshare_in_IT_ca=(psi_h^epsilon*cost_in_IT_ca^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,7)+psi_h^epsilon*cost_in_IT_ca^(1-epsilon)*broad_share_in(1,8));

lowshare_in_IT_ch=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,9)+psi_h^epsilon*cost_in_IT_ch^(1-epsilon)*broad_share_in(1,10));
highshare_in_IT_ch=(psi_h^epsilon*cost_in_IT_ch^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,9)+psi_h^epsilon*cost_in_IT_ch^(1-epsilon)*broad_share_in(1,10));

lowshare_in_Man_us=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,11)+psi_h^epsilon*cost_in_Man_us^(1-epsilon)*broad_share_in(1,12));
highshare_in_Man_us=(psi_h^epsilon*cost_in_Man_us^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,11)+psi_h^epsilon*cost_in_Man_us^(1-epsilon)*broad_share_in(1,12));

lowshare_in_Man_in=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,13)+psi_h^epsilon*cost_in_Man_in^(1-epsilon)*broad_share_in(1,14));
highshare_in_Man_in=(psi_h^epsilon*cost_in_Man_in^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,13)+psi_h^epsilon*cost_in_Man_in^(1-epsilon)*broad_share_in(1,14));

lowshare_in_Man_eu=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,15)+psi_h^epsilon*cost_in_Man_eu^(1-epsilon)*broad_share_in(1,16));
highshare_in_Man_eu=(psi_h^epsilon*cost_in_Man_eu^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,15)+psi_h^epsilon*cost_in_Man_eu^(1-epsilon)*broad_share_in(1,16));

lowshare_in_Man_ca=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,17)+psi_h^epsilon*cost_in_Man_ca^(1-epsilon)*broad_share_in(1,18));
highshare_in_Man_ca=(psi_h^epsilon*cost_in_Man_ca^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,17)+psi_h^epsilon*cost_in_Man_ca^(1-epsilon)*broad_share_in(1,18));

lowshare_in_Man_ch=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,19)+psi_h^epsilon*cost_in_Man_ch^(1-epsilon)*broad_share_in(1,20));
highshare_in_Man_ch=(psi_h^epsilon*cost_in_Man_ch^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,19)+psi_h^epsilon*cost_in_Man_ch^(1-epsilon)*broad_share_in(1,20));

lowshare_in_Oth_in=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,21)+psi_h^epsilon*cost_in_Oth_in^(1-epsilon)*broad_share_in(1,22));
highshare_in_Oth_in=(psi_h^epsilon*cost_in_Oth_in^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,21)+psi_h^epsilon*cost_in_Oth_in^(1-epsilon)*broad_share_in(1,22));

lowshare_in_Fin_us=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,23)+psi_h^epsilon*cost_in_Fin_us^(1-epsilon)*broad_share_in(1,24));
highshare_in_Fin_us=(psi_h^epsilon*cost_in_Fin_us^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,23)+psi_h^epsilon*cost_in_Fin_us^(1-epsilon)*broad_share_in(1,24));

lowshare_in_Fin_in=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,25)+psi_h^epsilon*cost_in_Fin_in^(1-epsilon)*broad_share_in(1,26));
highshare_in_Fin_in=(psi_h^epsilon*cost_in_Fin_in^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,25)+psi_h^epsilon*cost_in_Fin_in^(1-epsilon)*broad_share_in(1,26));

lowshare_in_Fin_eu=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,27)+psi_h^epsilon*cost_in_Fin_eu^(1-epsilon)*broad_share_in(1,28));
highshare_in_Fin_eu=(psi_h^epsilon*cost_in_Fin_eu^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,27)+psi_h^epsilon*cost_in_Fin_eu^(1-epsilon)*broad_share_in(1,28));

lowshare_in_Fin_ca=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,29)+psi_h^epsilon*cost_in_Fin_ca^(1-epsilon)*broad_share_in(1,30));
highshare_in_Fin_ca=(psi_h^epsilon*cost_in_Fin_ca^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,29)+psi_h^epsilon*cost_in_Fin_ca^(1-epsilon)*broad_share_in(1,30));

lowshare_in_Fin_ch=(psi_l^epsilon*w_in_L^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,31)+psi_h^epsilon*cost_in_Fin_ch^(1-epsilon)*broad_share_in(1,32));
highshare_in_Fin_ch=(psi_h^epsilon*cost_in_Fin_ch^(1-epsilon))/(psi_l^epsilon*w_in_L^(1-epsilon)*broad_share_in(1,31)+psi_h^epsilon*cost_in_Fin_ch^(1-epsilon)*broad_share_in(1,32));



%China


lowshare_ch_IT_us=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,1)+psi_h^epsilon*cost_ch_IT_us^(1-epsilon)*broad_share_ch(1,2));
highshare_ch_IT_us=(psi_h^epsilon*cost_ch_IT_us^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,1)+psi_h^epsilon*cost_ch_IT_us^(1-epsilon)*broad_share_ch(1,2));

lowshare_ch_IT_in=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,3)+psi_h^epsilon*cost_ch_IT_in^(1-epsilon)*broad_share_ch(1,4));
highshare_ch_IT_in=(psi_h^epsilon*cost_ch_IT_in^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,3)+psi_h^epsilon*cost_ch_IT_in^(1-epsilon)*broad_share_ch(1,4));

lowshare_ch_IT_eu=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,5)+psi_h^epsilon*cost_ch_IT_eu^(1-epsilon)*broad_share_ch(1,6));
highshare_ch_IT_eu=(psi_h^epsilon*cost_ch_IT_eu^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,5)+psi_h^epsilon*cost_ch_IT_eu^(1-epsilon)*broad_share_ch(1,6));

lowshare_ch_IT_ca=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,7)+psi_h^epsilon*cost_ch_IT_ca^(1-epsilon)*broad_share_ch(1,8));
highshare_ch_IT_ca=(psi_h^epsilon*cost_ch_IT_ca^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,7)+psi_h^epsilon*cost_ch_IT_ca^(1-epsilon)*broad_share_ch(1,8));

lowshare_ch_IT_ch=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,9)+psi_h^epsilon*cost_ch_IT_ch^(1-epsilon)*broad_share_ch(1,10));
highshare_ch_IT_ch=(psi_h^epsilon*cost_ch_IT_ch^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,9)+psi_h^epsilon*cost_ch_IT_ch^(1-epsilon)*broad_share_ch(1,10));

lowshare_ch_Man_us=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,11)+psi_h^epsilon*cost_ch_Man_us^(1-epsilon)*broad_share_ch(1,12));
highshare_ch_Man_us=(psi_h^epsilon*cost_ch_Man_us^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,11)+psi_h^epsilon*cost_ch_Man_us^(1-epsilon)*broad_share_ch(1,12));

lowshare_ch_Man_in=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,13)+psi_h^epsilon*cost_ch_Man_in^(1-epsilon)*broad_share_ch(1,14));
highshare_ch_Man_in=(psi_h^epsilon*cost_ch_Man_in^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,13)+psi_h^epsilon*cost_ch_Man_in^(1-epsilon)*broad_share_ch(1,14));

lowshare_ch_Man_eu=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,15)+psi_h^epsilon*cost_ch_Man_eu^(1-epsilon)*broad_share_ch(1,16));
highshare_ch_Man_eu=(psi_h^epsilon*cost_ch_Man_eu^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,15)+psi_h^epsilon*cost_ch_Man_eu^(1-epsilon)*broad_share_ch(1,16));

lowshare_ch_Man_ca=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,17)+psi_h^epsilon*cost_ch_Man_ca^(1-epsilon)*broad_share_ch(1,18));
highshare_ch_Man_ca=(psi_h^epsilon*cost_ch_Man_ca^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,17)+psi_h^epsilon*cost_ch_Man_ca^(1-epsilon)*broad_share_ch(1,18));

lowshare_ch_Man_ch=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,19)+psi_h^epsilon*cost_ch_Man_ch^(1-epsilon)*broad_share_ch(1,20));
highshare_ch_Man_ch=(psi_h^epsilon*cost_ch_Man_ch^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,19)+psi_h^epsilon*cost_ch_Man_ch^(1-epsilon)*broad_share_ch(1,20));

lowshare_ch_Oth_ch=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,21)+psi_h^epsilon*cost_ch_Oth_ch^(1-epsilon)*broad_share_ch(1,22));
highshare_ch_Oth_ch=(psi_h^epsilon*cost_ch_Oth_ch^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,21)+psi_h^epsilon*cost_ch_Oth_ch^(1-epsilon)*broad_share_ch(1,22));

lowshare_ch_Fin_us=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,23)+psi_h^epsilon*cost_ch_Fin_us^(1-epsilon)*broad_share_ch(1,24));
highshare_ch_Fin_us=(psi_h^epsilon*cost_ch_Fin_us^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,23)+psi_h^epsilon*cost_ch_Fin_us^(1-epsilon)*broad_share_ch(1,24));

lowshare_ch_Fin_in=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,25)+psi_h^epsilon*cost_ch_Fin_in^(1-epsilon)*broad_share_ch(1,26));
highshare_ch_Fin_in=(psi_h^epsilon*cost_ch_Fin_in^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,25)+psi_h^epsilon*cost_ch_Fin_in^(1-epsilon)*broad_share_ch(1,26));

lowshare_ch_Fin_eu=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,27)+psi_h^epsilon*cost_ch_Fin_eu^(1-epsilon)*broad_share_ch(1,28));
highshare_ch_Fin_eu=(psi_h^epsilon*cost_ch_Fin_eu^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,27)+psi_h^epsilon*cost_ch_Fin_eu^(1-epsilon)*broad_share_ch(1,28));

lowshare_ch_Fin_ca=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,29)+psi_h^epsilon*cost_ch_Fin_ca^(1-epsilon)*broad_share_ch(1,30));
highshare_ch_Fin_ca=(psi_h^epsilon*cost_ch_Fin_ca^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,29)+psi_h^epsilon*cost_ch_Fin_ca^(1-epsilon)*broad_share_ch(1,30));

lowshare_ch_Fin_ch=(psi_l^epsilon*w_ch_L^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,31)+psi_h^epsilon*cost_ch_Fin_ch^(1-epsilon)*broad_share_ch(1,32));
highshare_ch_Fin_ch=(psi_h^epsilon*cost_ch_Fin_ch^(1-epsilon))/(psi_l^epsilon*w_ch_L^(1-epsilon)*broad_share_ch(1,31)+psi_h^epsilon*cost_ch_Fin_ch^(1-epsilon)*broad_share_ch(1,32));



%Other

lowshare_ot_IT_ot=(psi_l^epsilon*w_ot_L^(1-epsilon))/(psi_l^epsilon*w_ot_L^(1-epsilon)*broad_share_ot(1,1)+psi_h^epsilon*cost_ot_IT_ot^(1-epsilon)*broad_share_ot(1,2));
highshare_ot_IT_ot=(psi_h^epsilon*cost_ot_IT_ot^(1-epsilon))/(psi_l^epsilon*w_ot_L^(1-epsilon)*broad_share_ot(1,1)+psi_h^epsilon*cost_ot_IT_ot^(1-epsilon)*broad_share_ot(1,2));

lowshare_ot_Man_ot=(psi_l^epsilon*w_ot_L^(1-epsilon))/(psi_l^epsilon*w_ot_L^(1-epsilon)*broad_share_ot(1,3)+psi_h^epsilon*cost_ot_Man_ot^(1-epsilon)*broad_share_ot(1,4));
highshare_ot_Man_ot=(psi_h^epsilon*cost_ot_Man_ot^(1-epsilon))/(psi_l^epsilon*w_ot_L^(1-epsilon)*broad_share_ot(1,3)+psi_h^epsilon*cost_ot_Man_ot^(1-epsilon)*broad_share_ot(1,4));

lowshare_ot_Oth_ot=(psi_l^epsilon*w_ot_L^(1-epsilon))/(psi_l^epsilon*w_ot_L^(1-epsilon)*broad_share_ot(1,5)+psi_h^epsilon*cost_ot_Oth_ot^(1-epsilon)*broad_share_ot(1,6));
highshare_ot_Oth_ot=(psi_h^epsilon*cost_ot_Oth_ot^(1-epsilon))/(psi_l^epsilon*w_ot_L^(1-epsilon)*broad_share_ot(1,5)+psi_h^epsilon*cost_ot_Oth_ot^(1-epsilon)*broad_share_ot(1,6));

lowshare_ot_Fin_ot=(psi_l^epsilon*w_ot_L^(1-epsilon))/(psi_l^epsilon*w_ot_L^(1-epsilon)*broad_share_ot(1,7)+psi_h^epsilon*cost_ot_Fin_ot^(1-epsilon)*broad_share_ot(1,8));
highshare_ot_Fin_ot=(psi_h^epsilon*cost_ot_Fin_ot^(1-epsilon))/(psi_l^epsilon*w_ot_L^(1-epsilon)*broad_share_ot(1,7)+psi_h^epsilon*cost_ot_Fin_ot^(1-epsilon)*broad_share_ot(1,8));


%High-skill share

%US

hshare_us_IT_us_d=(psi_d^lambda*w_us_IT_us_d^(1-lambda))/(psi_d^lambda*w_us_IT_us_d^(1-lambda)*skill_shares_us_us(1,1)+psi_f^lambda*w_us_IT_us_f^(1-lambda)*skill_shares_us_us(1,2));
hshare_us_IT_us_f=(psi_f^lambda*w_us_IT_us_f^(1-lambda))/(psi_d^lambda*w_us_IT_us_d^(1-lambda)*skill_shares_us_us(1,1)+psi_f^lambda*w_us_IT_us_f^(1-lambda)*skill_shares_us_us(1,2));

hshare_us_IT_in_d=(psi_d^lambda*w_us_IT_in_d^(1-lambda))/(psi_d^lambda*w_us_IT_in_d^(1-lambda)*skill_shares_us_in(1,1)+psi_f^lambda*costfs_us_IT_in^(1-lambda)*(skill_shares_us_in(1,3)+skill_shares_us_in(1,2)));
hshare_us_IT_in_fs=(psi_d^lambda*costfs_us_IT_in^(1-lambda))/(psi_d^lambda*w_us_IT_in_d^(1-lambda)*skill_shares_us_in(1,1)+psi_f^lambda*costfs_us_IT_in^(1-lambda)*(skill_shares_us_in(1,3)+skill_shares_us_in(1,2)));

hshare_us_IT_in_s=(psi_s^iota*w_us_IT_in_s^(1-iota))/(psi_s^iota*w_us_IT_in_s^(1-iota)*(skill_shares_us_in(1,2)/(skill_shares_us_in(1,2)+skill_shares_us_in(1,3)))+psi_f^iota*w_us_IT_in_f^(1-iota)*(skill_shares_us_in(1,3)/(skill_shares_us_in(1,2)+skill_shares_us_in(1,3))));
hshare_us_IT_in_f=(psi_f^iota*w_us_IT_in_f^(1-iota))/(psi_s^iota*w_us_IT_in_s^(1-iota)*(skill_shares_us_in(1,2)/(skill_shares_us_in(1,2)+skill_shares_us_in(1,3)))+psi_f^iota*w_us_IT_in_f^(1-iota)*(skill_shares_us_in(1,3)/(skill_shares_us_in(1,2)+skill_shares_us_in(1,3))));


hshare_us_IT_eu_d=psi_d^lambda*w_us_IT_eu_d^(1-lambda)/(psi_d^lambda*w_us_IT_eu_d^(1-lambda)*skill_shares_us_eu(1,1)+psi_f^lambda*costfs_us_IT_eu^(1-lambda)*(skill_shares_us_eu(1,3)+skill_shares_us_eu(1,2)));
hshare_us_IT_eu_fs=psi_d^lambda*costfs_us_IT_eu^(1-lambda)/(psi_d^lambda*w_us_IT_eu_d^(1-lambda)*skill_shares_us_eu(1,1)+psi_f^lambda*costfs_us_IT_eu^(1-lambda)*(skill_shares_us_eu(1,3)+skill_shares_us_eu(1,2)));

hshare_us_IT_eu_s=psi_s^iota*w_us_IT_eu_s^(1-iota)/(psi_s^iota*w_us_IT_eu_s^(1-iota)*(skill_shares_us_eu(1,2)/(skill_shares_us_eu(1,2)+skill_shares_us_eu(1,3)))+psi_f^iota*w_us_IT_eu_f^(1-iota)*(skill_shares_us_eu(1,3)/(skill_shares_us_eu(1,2)+skill_shares_us_eu(1,3))));
hshare_us_IT_eu_f=psi_f^iota*w_us_IT_eu_f^(1-iota)/(psi_s^iota*w_us_IT_eu_s^(1-iota)*(skill_shares_us_eu(1,2)/(skill_shares_us_eu(1,2)+skill_shares_us_eu(1,3)))+psi_f^iota*w_us_IT_eu_f^(1-iota)*(skill_shares_us_eu(1,3)/(skill_shares_us_eu(1,2)+skill_shares_us_eu(1,3))));


hshare_us_IT_ca_d=psi_d^lambda*w_us_IT_ca_d^(1-lambda)/(psi_d^lambda*w_us_IT_ca_d^(1-lambda)*skill_shares_us_ca(1,1)+psi_f^lambda*costfs_us_IT_eu^(1-lambda)*(skill_shares_us_ca(1,3)+skill_shares_us_ca(1,2)));
hshare_us_IT_ca_fs=psi_d^lambda*costfs_us_IT_ca^(1-lambda)/(psi_d^lambda*w_us_IT_ca_d^(1-lambda)*skill_shares_us_ca(1,1)+psi_f^lambda*costfs_us_IT_eu^(1-lambda)*(skill_shares_us_ca(1,3)+skill_shares_us_ca(1,2)));

hshare_us_IT_ca_s=psi_s^iota*w_us_IT_ca_s^(1-iota)/(psi_s^iota*w_us_IT_ca_s^(1-iota)*(skill_shares_us_ca(1,2)/(skill_shares_us_ca(1,2)+skill_shares_us_ca(1,3)))+psi_f^iota*w_us_IT_ca_f^(1-iota)*(skill_shares_us_ca(1,3)/(skill_shares_us_ca(1,2)+skill_shares_us_ca(1,3))));
hshare_us_IT_ca_f=psi_f^iota*w_us_IT_ca_f^(1-iota)/(psi_s^iota*w_us_IT_ca_s^(1-iota)*(skill_shares_us_ca(1,2)/(skill_shares_us_ca(1,2)+skill_shares_us_ca(1,3)))+psi_f^iota*w_us_IT_ca_f^(1-iota)*(skill_shares_us_ca(1,3)/(skill_shares_us_ca(1,2)+skill_shares_us_ca(1,3))));


hshare_us_IT_ch_d=psi_d^lambda*w_us_IT_ch_d^(1-lambda)/(psi_d^lambda*w_us_IT_ch_d^(1-lambda)*skill_shares_us_ch(1,1)+psi_f^lambda*costfs_us_IT_ch^(1-lambda)*(skill_shares_us_ch(1,3)+skill_shares_us_ch(1,2)));
hshare_us_IT_ch_fs=psi_d^lambda*costfs_us_IT_ch^(1-lambda)/(psi_d^lambda*w_us_IT_ch_d^(1-lambda)*skill_shares_us_ch(1,1)+psi_f^lambda*costfs_us_IT_ch^(1-lambda)*(skill_shares_us_ch(1,3)+skill_shares_us_ch(1,2)));


hshare_us_IT_ch_s=psi_s^iota*w_us_IT_ch_s^(1-iota)/(psi_s^iota*w_us_IT_ch_s^(1-iota)*(skill_shares_us_ch(1,2)/(skill_shares_us_ch(1,2)+skill_shares_us_ch(1,3)))+psi_f^iota*w_us_IT_ch_f^(1-iota)*(skill_shares_us_ch(1,3)/(skill_shares_us_ch(1,2)+skill_shares_us_ch(1,3))));
hshare_us_IT_ch_f=psi_f^iota*w_us_IT_ch_f^(1-iota)/(psi_s^iota*w_us_IT_ch_s^(1-iota)*(skill_shares_us_ch(1,2)/(skill_shares_us_ch(1,2)+skill_shares_us_ch(1,3)))+psi_f^iota*w_us_IT_ch_f^(1-iota)*(skill_shares_us_ch(1,3)/(skill_shares_us_ch(1,2)+skill_shares_us_ch(1,3))));



hshare_us_Man_us_d=psi_d^lambda*w_us_Man_us_d^(1-lambda)/(psi_d^lambda*w_us_Man_us_d^(1-lambda)*skill_shares_us_us(1,3)+psi_f^lambda*w_us_Man_us_f^(1-lambda)*skill_shares_us_us(1,4));
hshare_us_Man_us_f=psi_f^lambda*w_us_Man_us_f^(1-lambda)/(psi_d^lambda*w_us_Man_us_d^(1-lambda)*skill_shares_us_us(1,3)+psi_f^lambda*w_us_Man_us_f^(1-lambda)*skill_shares_us_us(1,4));


hshare_us_Man_in_d=psi_d^lambda*w_us_Man_in_d^(1-lambda)/(psi_d^lambda*w_us_Man_in_d^(1-lambda)*skill_shares_us_in(1,4)+psi_f^lambda*costfs_us_Man_in^(1-lambda)*(skill_shares_us_in(1,6)+skill_shares_us_in(1,5)));
hshare_us_Man_in_fs=psi_d^lambda*costfs_us_Man_in^(1-lambda)/(psi_d^lambda*w_us_Man_in_d^(1-lambda)*skill_shares_us_in(1,4)+psi_f^lambda*costfs_us_Man_in^(1-lambda)*(skill_shares_us_in(1,6)+skill_shares_us_in(1,5)));

hshare_us_Man_in_s=psi_s^iota*w_us_Man_in_s^(1-iota)/(psi_s^iota*w_us_Man_in_s^(1-iota)*(skill_shares_us_in(1,5)/(skill_shares_us_in(1,5)+skill_shares_us_in(1,6)))+psi_f^iota*w_us_Man_in_f^(1-iota)*(skill_shares_us_in(1,6)/(skill_shares_us_in(1,5)+skill_shares_us_in(1,6))));
hshare_us_Man_in_f=psi_f^iota*w_us_Man_in_f^(1-iota)/(psi_s^iota*w_us_Man_in_s^(1-iota)*(skill_shares_us_in(1,5)/(skill_shares_us_in(1,5)+skill_shares_us_in(1,6)))+psi_f^iota*w_us_Man_in_f^(1-iota)*(skill_shares_us_in(1,6)/(skill_shares_us_in(1,5)+skill_shares_us_in(1,6))));


hshare_us_Man_eu_d=psi_d^lambda*w_us_Man_eu_d^(1-lambda)/(psi_d^lambda*w_us_Man_eu_d^(1-lambda)*skill_shares_us_eu(1,4)+psi_f^lambda*costfs_us_Man_eu^(1-lambda)*(skill_shares_us_eu(1,6)+skill_shares_us_eu(1,5)));
hshare_us_Man_eu_fs=psi_d^lambda*costfs_us_Man_eu^(1-lambda)/(psi_d^lambda*w_us_Man_eu_d^(1-lambda)*skill_shares_us_eu(1,4)+psi_f^lambda*costfs_us_Man_eu^(1-lambda)*(skill_shares_us_eu(1,6)+skill_shares_us_eu(1,5)));

hshare_us_Man_eu_s=psi_s^iota*w_us_Man_eu_s^(1-iota)/(psi_s^iota*w_us_Man_eu_s^(1-iota)*(skill_shares_us_eu(1,5)/(skill_shares_us_eu(1,5)+skill_shares_us_eu(1,6)))+psi_f^iota*w_us_Man_eu_f^(1-iota)*(skill_shares_us_eu(1,6)/(skill_shares_us_eu(1,5)+skill_shares_us_eu(1,6))));
hshare_us_Man_eu_f=psi_f^iota*w_us_Man_eu_f^(1-iota)/(psi_s^iota*w_us_Man_eu_s^(1-iota)*(skill_shares_us_eu(1,5)/(skill_shares_us_eu(1,5)+skill_shares_us_eu(1,6)))+psi_f^iota*w_us_Man_eu_f^(1-iota)*(skill_shares_us_eu(1,6)/(skill_shares_us_eu(1,5)+skill_shares_us_eu(1,6))));


hshare_us_Man_ca_d=psi_d^lambda*w_us_Man_ca_d^(1-lambda)/(psi_d^lambda*w_us_Man_ca_d^(1-lambda)*skill_shares_us_ca(1,4)+psi_f^lambda*costfs_us_Man_ca^(1-lambda)*(skill_shares_us_ca(1,6)+skill_shares_us_ca(1,5)));
hshare_us_Man_ca_fs=psi_d^lambda*costfs_us_Man_ca^(1-lambda)/(psi_d^lambda*w_us_Man_ca_d^(1-lambda)*skill_shares_us_ca(1,4)+psi_f^lambda*costfs_us_Man_ca^(1-lambda)*(skill_shares_us_ca(1,6)+skill_shares_us_ca(1,5)));

hshare_us_Man_ca_s=psi_s^iota*w_us_Man_ca_s^(1-iota)/(psi_s^iota*w_us_Man_ca_s^(1-iota)*(skill_shares_us_ca(1,5)/(skill_shares_us_ca(1,5)+skill_shares_us_ca(1,6)))+psi_f^iota*w_us_Man_ca_f^(1-iota)*(skill_shares_us_ca(1,6)/(skill_shares_us_ca(1,5)+skill_shares_us_ca(1,6))));
hshare_us_Man_ca_f=psi_f^iota*w_us_Man_ca_f^(1-iota)/(psi_s^iota*w_us_Man_ca_s^(1-iota)*(skill_shares_us_ca(1,5)/(skill_shares_us_ca(1,5)+skill_shares_us_ca(1,6)))+psi_f^iota*w_us_Man_ca_f^(1-iota)*(skill_shares_us_ca(1,6)/(skill_shares_us_ca(1,5)+skill_shares_us_ca(1,6))));


hshare_us_Man_ch_d=psi_d^lambda*w_us_Man_ch_d^(1-lambda)/(psi_d^lambda*w_us_Man_ch_d^(1-lambda)*skill_shares_us_ch(1,4)+psi_f^lambda*costfs_us_Man_ch^(1-lambda)*(skill_shares_us_ch(1,6)+skill_shares_us_ch(1,5)));
hshare_us_Man_ch_fs=psi_d^lambda*costfs_us_Man_ch^(1-lambda)/(psi_d^lambda*w_us_Man_ch_d^(1-lambda)*skill_shares_us_ch(1,4)+psi_f^lambda*costfs_us_Man_ch^(1-lambda)*(skill_shares_us_ch(1,6)+skill_shares_us_ch(1,5)));

hshare_us_Man_ch_s=psi_s^iota*w_us_Man_ch_s^(1-iota)/(psi_s^iota*w_us_Man_ch_s^(1-iota)*(skill_shares_us_ch(1,5)/(skill_shares_us_ch(1,5)+skill_shares_us_ch(1,6)))+psi_f^iota*w_us_Man_ch_f^(1-iota)*(skill_shares_us_ch(1,6)/(skill_shares_us_ch(1,5)+skill_shares_us_ch(1,6))));
hshare_us_Man_ch_f=psi_f^iota*w_us_Man_ch_f^(1-iota)/(psi_s^iota*w_us_Man_ch_s^(1-iota)*(skill_shares_us_ch(1,5)/(skill_shares_us_ch(1,5)+skill_shares_us_ch(1,6)))+psi_f^iota*w_us_Man_ch_f^(1-iota)*(skill_shares_us_ch(1,6)/(skill_shares_us_ch(1,5)+skill_shares_us_ch(1,6))));


hshare_us_Oth_us_d=(psi_d^lambda*w_us_Oth_us_d^(1-lambda))/(psi_d^lambda*w_us_Oth_us_d^(1-lambda)*skill_shares_us_us(1,5)+psi_f^lambda*w_us_Oth_us_f^(1-lambda)*skill_shares_us_us(1,6));
hshare_us_Oth_us_f=(psi_f^lambda*w_us_Oth_us_f^(1-lambda))/(psi_d^lambda*w_us_Oth_us_d^(1-lambda)*skill_shares_us_us(1,5)+psi_f^lambda*w_us_Oth_us_f^(1-lambda)*skill_shares_us_us(1,6));


hshare_us_Fin_us_d=psi_d^lambda*w_us_Fin_us_d^(1-lambda)/(psi_d^lambda*w_us_Fin_us_d^(1-lambda)*skill_shares_us_us(1,7)+psi_f^lambda*w_us_Fin_us_f^(1-lambda)*skill_shares_us_us(1,8));
hshare_us_Fin_us_f=psi_f^lambda*w_us_Fin_us_f^(1-lambda)/(psi_d^lambda*w_us_Fin_us_d^(1-lambda)*skill_shares_us_us(1,7)+psi_f^lambda*w_us_Fin_us_f^(1-lambda)*skill_shares_us_us(1,8));


hshare_us_Fin_in_d=psi_d^lambda*w_us_Fin_in_d^(1-lambda)/(psi_d^lambda*w_us_Fin_in_d^(1-lambda)*skill_shares_us_in(1,7)+psi_f^lambda*costfs_us_Fin_in^(1-lambda)*(skill_shares_us_in(1,8)+skill_shares_us_in(1,9)));
hshare_us_Fin_in_fs=psi_d^lambda*costfs_us_Fin_in^(1-lambda)/(psi_d^lambda*w_us_Fin_in_d^(1-lambda)*skill_shares_us_in(1,7)+psi_f^lambda*costfs_us_Fin_in^(1-lambda)*(skill_shares_us_in(1,8)+skill_shares_us_in(1,9)));

hshare_us_Fin_in_s=psi_s^iota*w_us_Fin_in_s^(1-iota)/(psi_s^iota*w_us_Fin_in_s^(1-iota)*(skill_shares_us_in(1,8)/(skill_shares_us_in(1,8)+skill_shares_us_in(1,9)))+psi_f^iota*w_us_Fin_in_f^(1-iota)*(skill_shares_us_in(1,9)/(skill_shares_us_in(1,8)+skill_shares_us_in(1,9))));
hshare_us_Fin_in_f=psi_f^iota*w_us_Fin_in_f^(1-iota)/(psi_s^iota*w_us_Fin_in_s^(1-iota)*(skill_shares_us_in(1,8)/(skill_shares_us_in(1,8)+skill_shares_us_in(1,9)))+psi_f^iota*w_us_Fin_in_f^(1-iota)*(skill_shares_us_in(1,9)/(skill_shares_us_in(1,8)+skill_shares_us_in(1,9))));


hshare_us_Fin_eu_d=psi_d^lambda*w_us_Fin_eu_d^(1-lambda)/(psi_d^lambda*w_us_Fin_eu_d^(1-lambda)*skill_shares_us_eu(1,7)+psi_f^lambda*costfs_us_Fin_eu^(1-lambda)*(skill_shares_us_eu(1,8)+skill_shares_us_eu(1,9)));
hshare_us_Fin_eu_fs=psi_d^lambda*costfs_us_Fin_eu^(1-lambda)/(psi_d^lambda*w_us_Fin_eu_d^(1-lambda)*skill_shares_us_eu(1,7)+psi_f^lambda*costfs_us_Fin_eu^(1-lambda)*(skill_shares_us_eu(1,8)+skill_shares_us_eu(1,9)));

hshare_us_Fin_eu_s=psi_s^iota*w_us_Fin_eu_s^(1-iota)/(psi_s^iota*w_us_Fin_eu_s^(1-iota)*(skill_shares_us_eu(1,8)/(skill_shares_us_eu(1,8)+skill_shares_us_eu(1,9)))+psi_f^iota*w_us_Fin_eu_f^(1-iota)*(skill_shares_us_eu(1,9)/(skill_shares_us_eu(1,8)+skill_shares_us_eu(1,9))));
hshare_us_Fin_eu_f=psi_f^iota*w_us_Fin_eu_f^(1-iota)/(psi_s^iota*w_us_Fin_eu_s^(1-iota)*(skill_shares_us_eu(1,8)/(skill_shares_us_eu(1,8)+skill_shares_us_eu(1,9)))+psi_f^iota*w_us_Fin_eu_f^(1-iota)*(skill_shares_us_eu(1,9)/(skill_shares_us_eu(1,8)+skill_shares_us_eu(1,9))));


hshare_us_Fin_ca_d=psi_d^lambda*w_us_Fin_ca_d^(1-lambda)/(psi_d^lambda*w_us_Fin_ca_d^(1-lambda)*skill_shares_us_ca(1,7)+psi_f^lambda*costfs_us_Fin_ca^(1-lambda)*(skill_shares_us_ca(1,8)+skill_shares_us_ca(1,9)));
hshare_us_Fin_ca_fs=psi_d^lambda*costfs_us_Fin_ca^(1-lambda)/(psi_d^lambda*w_us_Fin_ca_d^(1-lambda)*skill_shares_us_ca(1,7)+psi_f^lambda*costfs_us_Fin_ca^(1-lambda)*(skill_shares_us_ca(1,8)+skill_shares_us_ca(1,9)));

hshare_us_Fin_ca_s=psi_s^iota*w_us_Fin_ca_s^(1-iota)/(psi_s^iota*w_us_Fin_ca_s^(1-iota)*(skill_shares_us_ca(1,8)/(skill_shares_us_ca(1,8)+skill_shares_us_ca(1,9)))+psi_f^iota*w_us_Fin_ca_f^(1-iota)*(skill_shares_us_ca(1,9)/(skill_shares_us_ca(1,8)+skill_shares_us_ca(1,9))));
hshare_us_Fin_ca_f=psi_f^iota*w_us_Fin_ca_f^(1-iota)/(psi_s^iota*w_us_Fin_ca_s^(1-iota)*(skill_shares_us_ca(1,8)/(skill_shares_us_ca(1,8)+skill_shares_us_ca(1,9)))+psi_f^iota*w_us_Fin_ca_f^(1-iota)*(skill_shares_us_ca(1,9)/(skill_shares_us_ca(1,8)+skill_shares_us_ca(1,9))));


hshare_us_Fin_ch_d=psi_d^lambda*w_us_Fin_ch_d^(1-lambda)/(psi_d^lambda*w_us_Fin_ch_d^(1-lambda)*skill_shares_us_ch(1,7)+psi_f^lambda*costfs_us_Fin_ch^(1-lambda)*(skill_shares_us_ch(1,8)+skill_shares_us_ch(1,9)));
hshare_us_Fin_ch_fs=psi_d^lambda*costfs_us_Fin_ch^(1-lambda)/(psi_d^lambda*w_us_Fin_ch_d^(1-lambda)*skill_shares_us_ch(1,7)+psi_f^lambda*costfs_us_Fin_ch^(1-lambda)*(skill_shares_us_ch(1,8)+skill_shares_us_ch(1,9)));

hshare_us_Fin_ch_s=psi_s^iota*w_us_Fin_ch_s^(1-iota)/(psi_s^iota*w_us_Fin_ch_s^(1-iota)*(skill_shares_us_ch(1,8)/(skill_shares_us_ch(1,8)+skill_shares_us_ch(1,9)))+psi_f^iota*w_us_Fin_ch_f^(1-iota)*(skill_shares_us_ch(1,9)/(skill_shares_us_ch(1,8)+skill_shares_us_ch(1,9))));
hshare_us_Fin_ch_f=psi_f^iota*w_us_Fin_ch_f^(1-iota)/(psi_s^iota*w_us_Fin_ch_s^(1-iota)*(skill_shares_us_ch(1,8)/(skill_shares_us_ch(1,8)+skill_shares_us_ch(1,9)))+psi_f^iota*w_us_Fin_ch_f^(1-iota)*(skill_shares_us_ch(1,9)/(skill_shares_us_ch(1,8)+skill_shares_us_ch(1,9))));




%Europe

hshare_eu_IT_eu_d=psi_d^lambda*w_eu_IT_eu_d^(1-lambda)/(psi_d^lambda*w_eu_IT_eu_d^(1-lambda)*skill_shares_eu_eu(1,1)+psi_f^lambda*w_eu_IT_eu_f^(1-lambda)*skill_shares_eu_eu(1,2));
hshare_eu_IT_eu_f=psi_f^lambda*w_eu_IT_eu_f^(1-lambda)/(psi_d^lambda*w_eu_IT_eu_d^(1-lambda)*skill_shares_eu_eu(1,1)+psi_f^lambda*w_eu_IT_eu_f^(1-lambda)*skill_shares_eu_eu(1,2));

hshare_eu_IT_in_d=psi_d^lambda*w_eu_IT_in_d^(1-lambda)/(psi_d^lambda*w_eu_IT_in_d^(1-lambda)*skill_shares_eu_in(1,1)+psi_f^lambda*costfs_eu_IT_in^(1-lambda)*(skill_shares_eu_in(1,3)+skill_shares_eu_in(1,2)));
hshare_eu_IT_in_fs=psi_d^lambda*costfs_eu_IT_in^(1-lambda)/(psi_d^lambda*w_eu_IT_in_d^(1-lambda)*skill_shares_eu_in(1,1)+psi_f^lambda*costfs_eu_IT_in^(1-lambda)*(skill_shares_eu_in(1,3)+skill_shares_eu_in(1,2)));

hshare_eu_IT_in_s=psi_s^iota*w_eu_IT_in_s^(1-iota)/(psi_s^iota*w_eu_IT_in_s^(1-iota)*(skill_shares_eu_in(1,2)/(skill_shares_eu_in(1,2)+skill_shares_eu_in(1,3)))+psi_f^iota*w_eu_IT_in_f^(1-iota)*(skill_shares_eu_in(1,3)/(skill_shares_eu_in(1,2)+skill_shares_eu_in(1,3))));
hshare_eu_IT_in_f=psi_f^iota*w_eu_IT_in_f^(1-iota)/(psi_s^iota*w_eu_IT_in_s^(1-iota)*(skill_shares_eu_in(1,2)/(skill_shares_eu_in(1,2)+skill_shares_eu_in(1,3)))+psi_f^iota*w_eu_IT_in_f^(1-iota)*(skill_shares_eu_in(1,3)/(skill_shares_eu_in(1,2)+skill_shares_eu_in(1,3))));


hshare_eu_IT_us_d=psi_d^lambda*w_eu_IT_us_d^(1-lambda)/(psi_d^lambda*w_eu_IT_us_d^(1-lambda)*skill_shares_eu_us(1,1)+psi_f^lambda*costfs_eu_IT_us^(1-lambda)*(skill_shares_eu_us(1,3)+skill_shares_eu_us(1,2)));
hshare_eu_IT_us_fs=psi_d^lambda*costfs_eu_IT_us^(1-lambda)/(psi_d^lambda*w_eu_IT_us_d^(1-lambda)*skill_shares_eu_us(1,1)+psi_f^lambda*costfs_eu_IT_us^(1-lambda)*(skill_shares_eu_us(1,3)+skill_shares_eu_us(1,2)));

hshare_eu_IT_us_s=psi_s^iota*w_eu_IT_us_s^(1-iota)/(psi_s^iota*w_eu_IT_us_s^(1-iota)*(skill_shares_eu_us(1,2)/(skill_shares_eu_us(1,2)+skill_shares_eu_us(1,3)))+psi_f^iota*w_eu_IT_us_f^(1-iota)*(skill_shares_eu_us(1,3)/(skill_shares_eu_us(1,2)+skill_shares_eu_us(1,3))));
hshare_eu_IT_us_f=psi_f^iota*w_eu_IT_us_f^(1-iota)/(psi_s^iota*w_eu_IT_us_s^(1-iota)*(skill_shares_eu_us(1,2)/(skill_shares_eu_us(1,2)+skill_shares_eu_us(1,3)))+psi_f^iota*w_eu_IT_us_f^(1-iota)*(skill_shares_eu_us(1,3)/(skill_shares_eu_us(1,2)+skill_shares_eu_us(1,3))));


hshare_eu_IT_ca_d=psi_d^lambda*w_eu_IT_ca_d^(1-lambda)/(psi_d^lambda*w_eu_IT_ca_d^(1-lambda)*skill_shares_eu_ca(1,1)+psi_f^lambda*costfs_eu_IT_ca^(1-lambda)*(skill_shares_eu_ca(1,3)+skill_shares_eu_ca(1,2)));
hshare_eu_IT_ca_fs=psi_d^lambda*costfs_eu_IT_ca^(1-lambda)/(psi_d^lambda*w_eu_IT_ca_d^(1-lambda)*skill_shares_eu_ca(1,1)+psi_f^lambda*costfs_eu_IT_ca^(1-lambda)*(skill_shares_eu_ca(1,3)+skill_shares_eu_ca(1,2)));

hshare_eu_IT_ca_s=psi_s^iota*w_eu_IT_ca_s^(1-iota)/(psi_s^iota*w_eu_IT_ca_s^(1-iota)*(skill_shares_eu_ca(1,2)/(skill_shares_eu_ca(1,2)+skill_shares_eu_ca(1,3)))+psi_f^iota*w_eu_IT_ca_f^(1-iota)*(skill_shares_eu_ca(1,3)/(skill_shares_eu_ca(1,2)+skill_shares_eu_ca(1,3))));
hshare_eu_IT_ca_f=psi_f^iota*w_eu_IT_ca_f^(1-iota)/(psi_s^iota*w_eu_IT_ca_s^(1-iota)*(skill_shares_eu_ca(1,2)/(skill_shares_eu_ca(1,2)+skill_shares_eu_ca(1,3)))+psi_f^iota*w_eu_IT_ca_f^(1-iota)*(skill_shares_eu_ca(1,3)/(skill_shares_eu_ca(1,2)+skill_shares_eu_ca(1,3))));


hshare_eu_IT_ch_d=psi_d^lambda*w_eu_IT_ch_d^(1-lambda)/(psi_d^lambda*w_eu_IT_ch_d^(1-lambda)*skill_shares_eu_ch(1,1)+psi_f^lambda*costfs_eu_IT_ch^(1-lambda)*(skill_shares_eu_ch(1,3)+skill_shares_eu_ch(1,2)));
hshare_eu_IT_ch_fs=psi_d^lambda*costfs_eu_IT_ch^(1-lambda)/(psi_d^lambda*w_eu_IT_ch_d^(1-lambda)*skill_shares_eu_ch(1,1)+psi_f^lambda*costfs_eu_IT_ch^(1-lambda)*(skill_shares_eu_ch(1,3)+skill_shares_eu_ch(1,2)));

hshare_eu_IT_ch_s=psi_s^iota*w_eu_IT_ch_s^(1-iota)/(psi_s^iota*w_eu_IT_ch_s^(1-iota)*(skill_shares_eu_ch(1,2)/(skill_shares_eu_ch(1,2)+skill_shares_eu_ch(1,3)))+psi_f^iota*w_eu_IT_ch_f^(1-iota)*(skill_shares_eu_ch(1,3)/(skill_shares_eu_ch(1,2)+skill_shares_eu_ch(1,3))));
hshare_eu_IT_ch_f=psi_f^iota*w_eu_IT_ch_f^(1-iota)/(psi_s^iota*w_eu_IT_ch_s^(1-iota)*(skill_shares_eu_ch(1,2)/(skill_shares_eu_ch(1,2)+skill_shares_eu_ch(1,3)))+psi_f^iota*w_eu_IT_ch_f^(1-iota)*(skill_shares_eu_ch(1,3)/(skill_shares_eu_ch(1,2)+skill_shares_eu_ch(1,3))));



hshare_eu_Man_eu_d=psi_d^lambda*w_eu_Man_eu_d^(1-lambda)/(psi_d^lambda*w_eu_Man_eu_d^(1-lambda)*skill_shares_eu_eu(1,3)+psi_f^lambda*w_eu_Man_eu_f^(1-lambda)*skill_shares_eu_eu(1,4));
hshare_eu_Man_eu_f=psi_f^lambda*w_eu_Man_eu_f^(1-lambda)/(psi_d^lambda*w_eu_Man_eu_d^(1-lambda)*skill_shares_eu_eu(1,3)+psi_f^lambda*w_eu_Man_eu_f^(1-lambda)*skill_shares_eu_eu(1,4));

hshare_eu_Man_in_d=psi_d^lambda*w_eu_Man_in_d^(1-lambda)/(psi_d^lambda*w_eu_Man_in_d^(1-lambda)*skill_shares_eu_in(1,4)+psi_f^lambda*costfs_eu_Man_in^(1-lambda)*(skill_shares_eu_in(1,6)+skill_shares_eu_in(1,5)));
hshare_eu_Man_in_fs=psi_d^lambda*costfs_eu_Man_in^(1-lambda)/(psi_d^lambda*w_eu_Man_in_d^(1-lambda)*skill_shares_eu_in(1,4)+psi_f^lambda*costfs_eu_Man_in^(1-lambda)*(skill_shares_eu_in(1,6)+skill_shares_eu_in(1,5)));

hshare_eu_Man_in_s=psi_s^iota*w_eu_Man_in_s^(1-iota)/(psi_s^iota*w_eu_Man_in_s^(1-iota)*(skill_shares_eu_in(1,5)/(skill_shares_eu_in(1,5)+skill_shares_eu_in(1,6)))+psi_f^iota*w_eu_Man_in_f^(1-iota)*(skill_shares_eu_in(1,6)/(skill_shares_eu_in(1,5)+skill_shares_eu_in(1,6))));
hshare_eu_Man_in_f=psi_f^iota*w_eu_Man_in_f^(1-iota)/(psi_s^iota*w_eu_Man_in_s^(1-iota)*(skill_shares_eu_in(1,5)/(skill_shares_eu_in(1,5)+skill_shares_eu_in(1,6)))+psi_f^iota*w_eu_Man_in_f^(1-iota)*(skill_shares_eu_in(1,6)/(skill_shares_eu_in(1,5)+skill_shares_eu_in(1,6))));


hshare_eu_Man_us_d=psi_d^lambda*w_eu_Man_us_d^(1-lambda)/(psi_d^lambda*w_eu_Man_us_d^(1-lambda)*skill_shares_eu_us(1,4)+psi_f^lambda*costfs_eu_Man_us^(1-lambda)*(skill_shares_eu_us(1,6)+skill_shares_eu_us(1,5)));
hshare_eu_Man_us_fs=psi_d^lambda*costfs_eu_Man_us^(1-lambda)/(psi_d^lambda*w_eu_Man_us_d^(1-lambda)*skill_shares_eu_us(1,4)+psi_f^lambda*costfs_eu_Man_us^(1-lambda)*(skill_shares_eu_us(1,6)+skill_shares_eu_us(1,5)));

hshare_eu_Man_us_s=psi_s^iota*w_eu_Man_us_s^(1-iota)/(psi_s^iota*w_eu_Man_us_s^(1-iota)*(skill_shares_eu_us(1,5)/(skill_shares_eu_us(1,5)+skill_shares_eu_us(1,6)))+psi_f^iota*w_eu_Man_us_f^(1-iota)*(skill_shares_eu_us(1,6)/(skill_shares_eu_us(1,5)+skill_shares_eu_us(1,6))));
hshare_eu_Man_us_f=psi_f^iota*w_eu_Man_us_f^(1-iota)/(psi_s^iota*w_eu_Man_us_s^(1-iota)*(skill_shares_eu_us(1,5)/(skill_shares_eu_us(1,5)+skill_shares_eu_us(1,6)))+psi_f^iota*w_eu_Man_us_f^(1-iota)*(skill_shares_eu_us(1,6)/(skill_shares_eu_us(1,5)+skill_shares_eu_us(1,6))));


hshare_eu_Man_ca_d=psi_d^lambda*w_eu_Man_ca_d^(1-lambda)/(psi_d^lambda*w_eu_Man_ca_d^(1-lambda)*skill_shares_eu_ca(1,4)+psi_f^lambda*costfs_eu_Man_ca^(1-lambda)*(skill_shares_eu_ca(1,6)+skill_shares_eu_ca(1,5)));
hshare_eu_Man_ca_fs=psi_d^lambda*costfs_eu_Man_ca^(1-lambda)/(psi_d^lambda*w_eu_Man_ca_d^(1-lambda)*skill_shares_eu_ca(1,4)+psi_f^lambda*costfs_eu_Man_ca^(1-lambda)*(skill_shares_eu_ca(1,6)+skill_shares_eu_ca(1,5)));

hshare_eu_Man_ca_s=psi_s^iota*w_eu_Man_ca_s^(1-iota)/(psi_s^iota*w_eu_Man_ca_s^(1-iota)*(skill_shares_eu_ca(1,5)/(skill_shares_eu_ca(1,5)+skill_shares_eu_ca(1,6)))+psi_f^iota*w_eu_Man_ca_f^(1-iota)*(skill_shares_eu_ca(1,6)/(skill_shares_eu_ca(1,5)+skill_shares_eu_ca(1,6))));
hshare_eu_Man_ca_f=psi_f^iota*w_eu_Man_ca_f^(1-iota)/(psi_s^iota*w_eu_Man_ca_s^(1-iota)*(skill_shares_eu_ca(1,5)/(skill_shares_eu_ca(1,5)+skill_shares_eu_ca(1,6)))+psi_f^iota*w_eu_Man_ca_f^(1-iota)*(skill_shares_eu_ca(1,6)/(skill_shares_eu_ca(1,5)+skill_shares_eu_ca(1,6))));


hshare_eu_Man_ch_d=psi_d^lambda*w_eu_Man_ch_d^(1-lambda)/(psi_d^lambda*w_eu_Man_ch_d^(1-lambda)*skill_shares_eu_ch(1,4)+psi_f^lambda*costfs_eu_Man_ch^(1-lambda)*(skill_shares_eu_ch(1,6)+skill_shares_eu_ch(1,5)));
hshare_eu_Man_ch_fs=psi_d^lambda*costfs_eu_Man_ch^(1-lambda)/(psi_d^lambda*w_eu_Man_ch_d^(1-lambda)*skill_shares_eu_ch(1,4)+psi_f^lambda*costfs_eu_Man_ch^(1-lambda)*(skill_shares_eu_ch(1,6)+skill_shares_eu_ch(1,5)));

hshare_eu_Man_ch_s=psi_s^iota*w_eu_Man_ch_s^(1-iota)/(psi_s^iota*w_eu_Man_ch_s^(1-iota)*(skill_shares_eu_ch(1,5)/(skill_shares_eu_ch(1,5)+skill_shares_eu_ch(1,6)))+psi_f^iota*w_eu_Man_ch_f^(1-iota)*(skill_shares_eu_ch(1,6)/(skill_shares_eu_ch(1,5)+skill_shares_eu_ch(1,6))));
hshare_eu_Man_ch_f=psi_f^iota*w_eu_Man_ch_f^(1-iota)/(psi_s^iota*w_eu_Man_ch_s^(1-iota)*(skill_shares_eu_ch(1,5)/(skill_shares_eu_ch(1,5)+skill_shares_eu_ch(1,6)))+psi_f^iota*w_eu_Man_ch_f^(1-iota)*(skill_shares_eu_ch(1,6)/(skill_shares_eu_ch(1,5)+skill_shares_eu_ch(1,6))));

hshare_eu_Oth_eu_d=psi_d^lambda*w_eu_Oth_eu_d^(1-lambda)/(psi_d^lambda*w_eu_Oth_eu_d^(1-lambda)*skill_shares_eu_eu(1,5)+psi_f^lambda*w_eu_Oth_eu_f^(1-lambda)*skill_shares_eu_eu(1,6));
hshare_eu_Oth_eu_f=psi_f^lambda*w_eu_Oth_eu_f^(1-lambda)/(psi_d^lambda*w_eu_Oth_eu_d^(1-lambda)*skill_shares_eu_eu(1,5)+psi_f^lambda*w_eu_Oth_eu_f^(1-lambda)*skill_shares_eu_eu(1,6));


hshare_eu_Fin_eu_d=psi_d^lambda*w_eu_Fin_eu_d^(1-lambda)/(psi_d^lambda*w_eu_Fin_eu_d^(1-lambda)*skill_shares_eu_eu(1,7)+psi_f^lambda*w_eu_Fin_eu_f^(1-lambda)*skill_shares_eu_eu(1,8));
hshare_eu_Fin_eu_f=psi_f^lambda*w_eu_Fin_eu_f^(1-lambda)/(psi_d^lambda*w_eu_Fin_eu_d^(1-lambda)*skill_shares_eu_eu(1,7)+psi_f^lambda*w_eu_Fin_eu_f^(1-lambda)*skill_shares_eu_eu(1,8));

hshare_eu_Fin_in_d=psi_d^lambda*w_eu_Fin_in_d^(1-lambda)/(psi_d^lambda*w_eu_Fin_in_d^(1-lambda)*skill_shares_eu_in(1,7)+psi_f^lambda*costfs_eu_Fin_in^(1-lambda)*(skill_shares_eu_in(1,9)+skill_shares_eu_in(1,8)));
hshare_eu_Fin_in_fs=psi_d^lambda*costfs_eu_Fin_in^(1-lambda)/(psi_d^lambda*w_eu_Fin_in_d^(1-lambda)*skill_shares_eu_in(1,7)+psi_f^lambda*costfs_eu_Fin_in^(1-lambda)*(skill_shares_eu_in(1,9)+skill_shares_eu_in(1,8)));

hshare_eu_Fin_in_s=psi_s^iota*w_eu_Fin_in_s^(1-iota)/(psi_s^iota*w_eu_Fin_in_s^(1-iota)*(skill_shares_eu_in(1,8)/(skill_shares_eu_in(1,8)+skill_shares_eu_in(1,9)))+psi_f^iota*w_eu_Fin_in_f^(1-iota)*(skill_shares_eu_in(1,9)/(skill_shares_eu_in(1,8)+skill_shares_eu_in(1,9))));
hshare_eu_Fin_in_f=psi_f^iota*w_eu_Fin_in_f^(1-iota)/(psi_s^iota*w_eu_Fin_in_s^(1-iota)*(skill_shares_eu_in(1,8)/(skill_shares_eu_in(1,8)+skill_shares_eu_in(1,9)))+psi_f^iota*w_eu_Fin_in_f^(1-iota)*(skill_shares_eu_in(1,9)/(skill_shares_eu_in(1,8)+skill_shares_eu_in(1,9))));


hshare_eu_Fin_us_d=psi_d^lambda*w_eu_Fin_us_d^(1-lambda)/(psi_d^lambda*w_eu_Fin_us_d^(1-lambda)*skill_shares_eu_us(1,7)+psi_f^lambda*costfs_eu_Fin_us^(1-lambda)*(skill_shares_eu_us(1,9)+skill_shares_eu_us(1,8)));
hshare_eu_Fin_us_fs=psi_d^lambda*costfs_eu_Fin_us^(1-lambda)/(psi_d^lambda*w_eu_Fin_us_d^(1-lambda)*skill_shares_eu_us(1,7)+psi_f^lambda*costfs_eu_Fin_us^(1-lambda)*(skill_shares_eu_us(1,9)+skill_shares_eu_us(1,8)));

hshare_eu_Fin_us_s=psi_s^iota*w_eu_Fin_us_s^(1-iota)/(psi_s^iota*w_eu_Fin_us_s^(1-iota)*(skill_shares_eu_us(1,8)/(skill_shares_eu_us(1,8)+skill_shares_eu_us(1,9)))+psi_f^iota*w_eu_Fin_us_f^(1-iota)*(skill_shares_eu_us(1,9)/(skill_shares_eu_us(1,8)+skill_shares_eu_us(1,9))));
hshare_eu_Fin_us_f=psi_f^iota*w_eu_Fin_us_f^(1-iota)/(psi_s^iota*w_eu_Fin_us_s^(1-iota)*(skill_shares_eu_us(1,8)/(skill_shares_eu_us(1,8)+skill_shares_eu_us(1,9)))+psi_f^iota*w_eu_Fin_us_f^(1-iota)*(skill_shares_eu_us(1,9)/(skill_shares_eu_us(1,8)+skill_shares_eu_us(1,9))));


hshare_eu_Fin_ca_d=psi_d^lambda*w_eu_Fin_ca_d^(1-lambda)/(psi_d^lambda*w_eu_Fin_ca_d^(1-lambda)*skill_shares_eu_ca(1,7)+psi_f^lambda*costfs_eu_Fin_ca^(1-lambda)*(skill_shares_eu_ca(1,9)+skill_shares_eu_ca(1,8)));
hshare_eu_Fin_ca_fs=psi_d^lambda*costfs_eu_Fin_ca^(1-lambda)/(psi_d^lambda*w_eu_Fin_ca_d^(1-lambda)*skill_shares_eu_ca(1,7)+psi_f^lambda*costfs_eu_Fin_ca^(1-lambda)*(skill_shares_eu_ca(1,9)+skill_shares_eu_ca(1,8)));

hshare_eu_Fin_ca_s=psi_s^iota*w_eu_Fin_ca_s^(1-iota)/(psi_s^iota*w_eu_Fin_ca_s^(1-iota)*(skill_shares_eu_ca(1,8)/(skill_shares_eu_ca(1,8)+skill_shares_eu_ca(1,9)))+psi_f^iota*w_eu_Fin_ca_f^(1-iota)*(skill_shares_eu_ca(1,9)/(skill_shares_eu_ca(1,8)+skill_shares_eu_ca(1,9))));
hshare_eu_Fin_ca_f=psi_f^iota*w_eu_Fin_ca_f^(1-iota)/(psi_s^iota*w_eu_Fin_ca_s^(1-iota)*(skill_shares_eu_ca(1,8)/(skill_shares_eu_ca(1,8)+skill_shares_eu_ca(1,9)))+psi_f^iota*w_eu_Fin_ca_f^(1-iota)*(skill_shares_eu_ca(1,9)/(skill_shares_eu_ca(1,8)+skill_shares_eu_ca(1,9))));


hshare_eu_Fin_ch_d=psi_d^lambda*w_eu_Fin_ch_d^(1-lambda)/(psi_d^lambda*w_eu_Fin_ch_d^(1-lambda)*skill_shares_eu_ch(1,7)+psi_f^lambda*costfs_eu_Fin_ch^(1-lambda)*(skill_shares_eu_ch(1,9)+skill_shares_eu_ch(1,8)));
hshare_eu_Fin_ch_fs=psi_d^lambda*costfs_eu_Fin_ch^(1-lambda)/(psi_d^lambda*w_eu_Fin_ch_d^(1-lambda)*skill_shares_eu_ch(1,7)+psi_f^lambda*costfs_eu_Fin_ch^(1-lambda)*(skill_shares_eu_ch(1,9)+skill_shares_eu_ch(1,8)));

hshare_eu_Fin_ch_s=psi_s^iota*w_eu_Fin_ch_s^(1-iota)/(psi_s^iota*w_eu_Fin_ch_s^(1-iota)*(skill_shares_eu_ch(1,8)/(skill_shares_eu_ch(1,8)+skill_shares_eu_ch(1,9)))+psi_f^iota*w_eu_Fin_ch_f^(1-iota)*(skill_shares_eu_ch(1,9)/(skill_shares_eu_ch(1,8)+skill_shares_eu_ch(1,9))));
hshare_eu_Fin_ch_f=psi_f^iota*w_eu_Fin_ch_f^(1-iota)/(psi_s^iota*w_eu_Fin_ch_s^(1-iota)*(skill_shares_eu_ch(1,8)/(skill_shares_eu_ch(1,8)+skill_shares_eu_ch(1,9)))+psi_f^iota*w_eu_Fin_ch_f^(1-iota)*(skill_shares_eu_ch(1,9)/(skill_shares_eu_ch(1,8)+skill_shares_eu_ch(1,9))));




%Canada

hshare_ca_IT_ca_d=psi_d^lambda*w_ca_IT_ca_d^(1-lambda)/(psi_d^lambda*w_ca_IT_ca_d^(1-lambda)*skill_shares_ca_ca(1,1)+psi_f^lambda*w_ca_IT_ca_f^(1-lambda)*skill_shares_ca_ca(1,2));
hshare_ca_IT_ca_f=psi_f^lambda*w_ca_IT_ca_f^(1-lambda)/(psi_d^lambda*w_ca_IT_ca_d^(1-lambda)*skill_shares_ca_ca(1,1)+psi_f^lambda*w_ca_IT_ca_f^(1-lambda)*skill_shares_ca_ca(1,2));



hshare_ca_IT_in_d=psi_d^lambda*w_ca_IT_in_d^(1-lambda)/(psi_d^lambda*w_ca_IT_in_d^(1-lambda)*skill_shares_ca_in(1,1)+psi_f^lambda*costfs_ca_IT_in^(1-lambda)*(skill_shares_ca_in(1,3)+skill_shares_ca_in(1,2)));
hshare_ca_IT_in_fs=psi_d^lambda*costfs_ca_IT_in^(1-lambda)/(psi_d^lambda*w_ca_IT_in_d^(1-lambda)*skill_shares_ca_in(1,1)+psi_f^lambda*costfs_ca_IT_in^(1-lambda)*(skill_shares_ca_in(1,3)+skill_shares_ca_in(1,2)));

hshare_ca_IT_in_s=psi_s^iota*w_ca_IT_in_s^(1-iota)/(psi_s^iota*w_ca_IT_in_s^(1-iota)*(skill_shares_ca_in(1,2)/(skill_shares_ca_in(1,2)+skill_shares_ca_in(1,3)))+psi_f^iota*w_ca_IT_in_f^(1-iota)*(skill_shares_ca_in(1,3)/(skill_shares_ca_in(1,2)+skill_shares_ca_in(1,3))));
hshare_ca_IT_in_f=psi_f^iota*w_ca_IT_in_f^(1-iota)/(psi_s^iota*w_ca_IT_in_s^(1-iota)*(skill_shares_ca_in(1,2)/(skill_shares_ca_in(1,2)+skill_shares_ca_in(1,3)))+psi_f^iota*w_ca_IT_in_f^(1-iota)*(skill_shares_ca_in(1,3)/(skill_shares_ca_in(1,2)+skill_shares_ca_in(1,3))));


hshare_ca_IT_eu_d=psi_d^lambda*w_ca_IT_eu_d^(1-lambda)/(psi_d^lambda*w_ca_IT_eu_d^(1-lambda)*skill_shares_ca_eu(1,1)+psi_f^lambda*costfs_ca_IT_eu^(1-lambda)*(skill_shares_ca_eu(1,3)+skill_shares_ca_eu(1,2)));
hshare_ca_IT_eu_fs=psi_d^lambda*costfs_ca_IT_eu^(1-lambda)/(psi_d^lambda*w_ca_IT_eu_d^(1-lambda)*skill_shares_ca_eu(1,1)+psi_f^lambda*costfs_ca_IT_eu^(1-lambda)*(skill_shares_ca_eu(1,3)+skill_shares_ca_eu(1,2)));

hshare_ca_IT_eu_s=psi_s^iota*w_ca_IT_eu_s^(1-iota)/(psi_s^iota*w_ca_IT_eu_s^(1-iota)*(skill_shares_ca_eu(1,2)/(skill_shares_ca_eu(1,2)+skill_shares_ca_eu(1,3)))+psi_f^iota*w_ca_IT_eu_f^(1-iota)*(skill_shares_ca_eu(1,3)/(skill_shares_ca_eu(1,2)+skill_shares_ca_eu(1,3))));
hshare_ca_IT_eu_f=psi_f^iota*w_ca_IT_eu_f^(1-iota)/(psi_s^iota*w_ca_IT_eu_s^(1-iota)*(skill_shares_ca_eu(1,2)/(skill_shares_ca_eu(1,2)+skill_shares_ca_eu(1,3)))+psi_f^iota*w_ca_IT_eu_f^(1-iota)*(skill_shares_ca_eu(1,3)/(skill_shares_ca_eu(1,2)+skill_shares_ca_eu(1,3))));


hshare_ca_IT_us_d=psi_d^lambda*w_ca_IT_us_d^(1-lambda)/(psi_d^lambda*w_ca_IT_us_d^(1-lambda)*skill_shares_ca_us(1,1)+psi_f^lambda*costfs_ca_IT_us^(1-lambda)*(skill_shares_ca_us(1,3)+skill_shares_ca_us(1,2)));
hshare_ca_IT_us_fs=psi_d^lambda*costfs_ca_IT_us^(1-lambda)/(psi_d^lambda*w_ca_IT_us_d^(1-lambda)*skill_shares_ca_us(1,1)+psi_f^lambda*costfs_ca_IT_us^(1-lambda)*(skill_shares_ca_us(1,3)+skill_shares_ca_us(1,2)));

hshare_ca_IT_us_s=psi_s^iota*w_ca_IT_us_s^(1-iota)/(psi_s^iota*w_ca_IT_us_s^(1-iota)*(skill_shares_ca_us(1,2)/(skill_shares_ca_us(1,2)+skill_shares_ca_us(1,3)))+psi_f^iota*w_ca_IT_us_f^(1-iota)*(skill_shares_ca_us(1,3)/(skill_shares_ca_us(1,2)+skill_shares_ca_us(1,3))));
hshare_ca_IT_us_f=psi_f^iota*w_ca_IT_us_f^(1-iota)/(psi_s^iota*w_ca_IT_us_s^(1-iota)*(skill_shares_ca_us(1,2)/(skill_shares_ca_us(1,2)+skill_shares_ca_us(1,3)))+psi_f^iota*w_ca_IT_us_f^(1-iota)*(skill_shares_ca_us(1,3)/(skill_shares_ca_us(1,2)+skill_shares_ca_us(1,3))));


hshare_ca_IT_ch_d=psi_d^lambda*w_ca_IT_ch_d^(1-lambda)/(psi_d^lambda*w_ca_IT_ch_d^(1-lambda)*skill_shares_ca_ch(1,1)+psi_f^lambda*costfs_ca_IT_ch^(1-lambda)*(skill_shares_ca_ch(1,3)+skill_shares_ca_ch(1,2)));
hshare_ca_IT_ch_fs=psi_d^lambda*costfs_ca_IT_ch^(1-lambda)/(psi_d^lambda*w_ca_IT_ch_d^(1-lambda)*skill_shares_ca_ch(1,1)+psi_f^lambda*costfs_ca_IT_ch^(1-lambda)*(skill_shares_ca_ch(1,3)+skill_shares_ca_ch(1,2)));

hshare_ca_IT_ch_s=psi_s^iota*w_ca_IT_ch_s^(1-iota)/(psi_s^iota*w_ca_IT_ch_s^(1-iota)*(skill_shares_ca_ch(1,2)/(skill_shares_ca_ch(1,2)+skill_shares_ca_ch(1,3)))+psi_f^iota*w_ca_IT_ch_f^(1-iota)*(skill_shares_ca_ch(1,3)/(skill_shares_ca_ch(1,2)+skill_shares_ca_ch(1,3))));
hshare_ca_IT_ch_f=psi_f^iota*w_ca_IT_ch_f^(1-iota)/(psi_s^iota*w_ca_IT_ch_s^(1-iota)*(skill_shares_ca_ch(1,2)/(skill_shares_ca_ch(1,2)+skill_shares_ca_ch(1,3)))+psi_f^iota*w_ca_IT_ch_f^(1-iota)*(skill_shares_ca_ch(1,3)/(skill_shares_ca_ch(1,2)+skill_shares_ca_ch(1,3))));



hshare_ca_Man_ca_d=psi_d^lambda*w_ca_Man_ca_d^(1-lambda)/(psi_d^lambda*w_ca_Man_ca_d^(1-lambda)*skill_shares_ca_ca(1,3)+psi_f^lambda*w_ca_Man_ca_f^(1-lambda)*skill_shares_ca_ca(1,4));
hshare_ca_Man_ca_f=psi_f^lambda*w_ca_Man_ca_f^(1-lambda)/(psi_d^lambda*w_ca_Man_ca_d^(1-lambda)*skill_shares_ca_ca(1,3)+psi_f^lambda*w_ca_Man_ca_f^(1-lambda)*skill_shares_ca_ca(1,4));

hshare_ca_Man_in_d=psi_d^lambda*w_ca_Man_in_d^(1-lambda)/(psi_d^lambda*w_ca_Man_in_d^(1-lambda)*skill_shares_ca_in(1,4)+psi_f^lambda*costfs_ca_Man_in^(1-lambda)*(skill_shares_ca_in(1,6)+skill_shares_ca_in(1,5)));
hshare_ca_Man_in_fs=psi_d^lambda*costfs_ca_Man_in^(1-lambda)/(psi_d^lambda*w_ca_Man_in_d^(1-lambda)*skill_shares_ca_in(1,4)+psi_f^lambda*costfs_ca_Man_in^(1-lambda)*(skill_shares_ca_in(1,6)+skill_shares_ca_in(1,5)));

hshare_ca_Man_in_s=psi_s^iota*w_ca_Man_in_s^(1-iota)/(psi_s^iota*w_ca_Man_in_s^(1-iota)*(skill_shares_ca_in(1,5)/(skill_shares_ca_in(1,5)+skill_shares_ca_in(1,6)))+psi_f^iota*w_ca_Man_in_f^(1-iota)*(skill_shares_ca_in(1,6)/(skill_shares_ca_in(1,5)+skill_shares_ca_in(1,6))));
hshare_ca_Man_in_f=psi_f^iota*w_ca_Man_in_f^(1-iota)/(psi_s^iota*w_ca_Man_in_s^(1-iota)*(skill_shares_ca_in(1,5)/(skill_shares_ca_in(1,5)+skill_shares_ca_in(1,6)))+psi_f^iota*w_ca_Man_in_f^(1-iota)*(skill_shares_ca_in(1,6)/(skill_shares_ca_in(1,5)+skill_shares_ca_in(1,6))));



hshare_ca_Man_eu_d=psi_d^lambda*w_ca_Man_eu_d^(1-lambda)/(psi_d^lambda*w_ca_Man_eu_d^(1-lambda)*skill_shares_ca_eu(1,4)+psi_f^lambda*costfs_ca_Man_eu^(1-lambda)*(skill_shares_ca_eu(1,6)+skill_shares_ca_eu(1,5)));
hshare_ca_Man_eu_fs=psi_d^lambda*costfs_ca_Man_eu^(1-lambda)/(psi_d^lambda*w_ca_Man_eu_d^(1-lambda)*skill_shares_ca_eu(1,4)+psi_f^lambda*costfs_ca_Man_eu^(1-lambda)*(skill_shares_ca_eu(1,6)+skill_shares_ca_eu(1,5)));

hshare_ca_Man_eu_s=psi_s^iota*w_ca_Man_eu_s^(1-iota)/(psi_s^iota*w_ca_Man_eu_s^(1-iota)*(skill_shares_ca_eu(1,5)/(skill_shares_ca_eu(1,5)+skill_shares_ca_eu(1,6)))+psi_f^iota*w_ca_Man_eu_f^(1-iota)*(skill_shares_ca_eu(1,6)/(skill_shares_ca_eu(1,5)+skill_shares_ca_eu(1,6))));
hshare_ca_Man_eu_f=psi_f^iota*w_ca_Man_eu_f^(1-iota)/(psi_s^iota*w_ca_Man_eu_s^(1-iota)*(skill_shares_ca_eu(1,5)/(skill_shares_ca_eu(1,5)+skill_shares_ca_eu(1,6)))+psi_f^iota*w_ca_Man_eu_f^(1-iota)*(skill_shares_ca_eu(1,6)/(skill_shares_ca_eu(1,5)+skill_shares_ca_eu(1,6))));


hshare_ca_Man_us_d=psi_d^lambda*w_ca_Man_us_d^(1-lambda)/(psi_d^lambda*w_ca_Man_us_d^(1-lambda)*skill_shares_ca_us(1,4)+psi_f^lambda*costfs_ca_Man_us^(1-lambda)*(skill_shares_ca_us(1,6)+skill_shares_ca_us(1,5)));
hshare_ca_Man_us_fs=psi_d^lambda*costfs_ca_Man_us^(1-lambda)/(psi_d^lambda*w_ca_Man_us_d^(1-lambda)*skill_shares_ca_us(1,4)+psi_f^lambda*costfs_ca_Man_us^(1-lambda)*(skill_shares_ca_us(1,6)+skill_shares_ca_us(1,5)));

hshare_ca_Man_us_s=psi_s^iota*w_ca_Man_us_s^(1-iota)/(psi_s^iota*w_ca_Man_us_s^(1-iota)*(skill_shares_ca_us(1,5)/(skill_shares_ca_us(1,5)+skill_shares_ca_us(1,6)))+psi_f^iota*w_ca_Man_us_f^(1-iota)*(skill_shares_ca_us(1,6)/(skill_shares_ca_us(1,5)+skill_shares_ca_us(1,6))));
hshare_ca_Man_us_f=psi_f^iota*w_ca_Man_us_f^(1-iota)/(psi_s^iota*w_ca_Man_us_s^(1-iota)*(skill_shares_ca_us(1,5)/(skill_shares_ca_us(1,5)+skill_shares_ca_us(1,6)))+psi_f^iota*w_ca_Man_us_f^(1-iota)*(skill_shares_ca_us(1,6)/(skill_shares_ca_us(1,5)+skill_shares_ca_us(1,6))));


hshare_ca_Man_ch_d=psi_d^lambda*w_ca_Man_ch_d^(1-lambda)/(psi_d^lambda*w_ca_Man_ch_d^(1-lambda)*skill_shares_ca_ch(1,4)+psi_f^lambda*costfs_ca_Man_ch^(1-lambda)*(skill_shares_ca_ch(1,6)+skill_shares_ca_ch(1,5)));
hshare_ca_Man_ch_fs=psi_d^lambda*costfs_ca_Man_ch^(1-lambda)/(psi_d^lambda*w_ca_Man_ch_d^(1-lambda)*skill_shares_ca_ch(1,4)+psi_f^lambda*costfs_ca_Man_ch^(1-lambda)*(skill_shares_ca_ch(1,6)+skill_shares_ca_ch(1,5)));

hshare_ca_Man_ch_s=psi_s^iota*w_ca_Man_ch_s^(1-iota)/(psi_s^iota*w_ca_Man_ch_s^(1-iota)*(skill_shares_ca_ch(1,5)/(skill_shares_ca_ch(1,5)+skill_shares_ca_ch(1,6)))+psi_f^iota*w_ca_Man_ch_f^(1-iota)*(skill_shares_ca_ch(1,6)/(skill_shares_ca_ch(1,5)+skill_shares_ca_ch(1,6))));
hshare_ca_Man_ch_f=psi_f^iota*w_ca_Man_ch_f^(1-iota)/(psi_s^iota*w_ca_Man_ch_s^(1-iota)*(skill_shares_ca_ch(1,5)/(skill_shares_ca_ch(1,5)+skill_shares_ca_ch(1,6)))+psi_f^iota*w_ca_Man_ch_f^(1-iota)*(skill_shares_ca_ch(1,6)/(skill_shares_ca_ch(1,5)+skill_shares_ca_ch(1,6))));


hshare_ca_Oth_ca_d=psi_d^lambda*w_ca_Oth_ca_d^(1-lambda)/(psi_d^lambda*w_ca_Oth_ca_d^(1-lambda)*skill_shares_ca_ca(1,5)+psi_f^lambda*w_ca_Oth_ca_f^(1-lambda)*skill_shares_ca_ca(1,6));
hshare_ca_Oth_ca_f=psi_f^lambda*w_ca_Oth_ca_f^(1-lambda)/(psi_d^lambda*w_ca_Oth_ca_d^(1-lambda)*skill_shares_ca_ca(1,5)+psi_f^lambda*w_ca_Oth_ca_f^(1-lambda)*skill_shares_ca_ca(1,6));


hshare_ca_Fin_ca_d=psi_d^lambda*w_ca_Fin_ca_d^(1-lambda)/(psi_d^lambda*w_ca_Fin_ca_d^(1-lambda)*skill_shares_ca_ca(1,7)+psi_f^lambda*w_ca_Fin_ca_f^(1-lambda)*skill_shares_ca_ca(1,8));
hshare_ca_Fin_ca_f=psi_f^lambda*w_ca_Fin_ca_f^(1-lambda)/(psi_d^lambda*w_ca_Fin_ca_d^(1-lambda)*skill_shares_ca_ca(1,7)+psi_f^lambda*w_ca_Fin_ca_f^(1-lambda)*skill_shares_ca_ca(1,8));

hshare_ca_Fin_in_d=psi_d^lambda*w_ca_Fin_in_d^(1-lambda)/(psi_d^lambda*w_ca_Fin_in_d^(1-lambda)*skill_shares_ca_in(1,7)+psi_f^lambda*costfs_ca_Fin_in^(1-lambda)*(skill_shares_ca_in(1,9)+skill_shares_ca_in(1,8)));
hshare_ca_Fin_in_fs=psi_d^lambda*costfs_ca_Fin_in^(1-lambda)/(psi_d^lambda*w_ca_Fin_in_d^(1-lambda)*skill_shares_ca_in(1,7)+psi_f^lambda*costfs_ca_Fin_in^(1-lambda)*(skill_shares_ca_in(1,9)+skill_shares_ca_in(1,8)));

hshare_ca_Fin_in_s=psi_s^iota*w_ca_Fin_in_s^(1-iota)/(psi_s^iota*w_ca_Fin_in_s^(1-iota)*(skill_shares_ca_in(1,8)/(skill_shares_ca_in(1,8)+skill_shares_ca_in(1,9)))+psi_f^iota*w_ca_Fin_in_f^(1-iota)*(skill_shares_ca_in(1,9)/(skill_shares_ca_in(1,8)+skill_shares_ca_in(1,9))));
hshare_ca_Fin_in_f=psi_f^iota*w_ca_Fin_in_f^(1-iota)/(psi_s^iota*w_ca_Fin_in_s^(1-iota)*(skill_shares_ca_in(1,8)/(skill_shares_ca_in(1,8)+skill_shares_ca_in(1,9)))+psi_f^iota*w_ca_Fin_in_f^(1-iota)*(skill_shares_ca_in(1,9)/(skill_shares_ca_in(1,8)+skill_shares_ca_in(1,9))));



hshare_ca_Fin_eu_d=psi_d^lambda*w_ca_Fin_eu_d^(1-lambda)/(psi_d^lambda*w_ca_Fin_eu_d^(1-lambda)*skill_shares_ca_eu(1,7)+psi_f^lambda*costfs_ca_Fin_eu^(1-lambda)*(skill_shares_ca_eu(1,9)+skill_shares_ca_eu(1,8)));
hshare_ca_Fin_eu_fs=psi_d^lambda*costfs_ca_Fin_eu^(1-lambda)/(psi_d^lambda*w_ca_Fin_eu_d^(1-lambda)*skill_shares_ca_eu(1,7)+psi_f^lambda*costfs_ca_Fin_eu^(1-lambda)*(skill_shares_ca_eu(1,9)+skill_shares_ca_eu(1,8)));

hshare_ca_Fin_eu_s=psi_s^iota*w_ca_Fin_eu_s^(1-iota)/(psi_s^iota*w_ca_Fin_eu_s^(1-iota)*(skill_shares_ca_eu(1,8)/(skill_shares_ca_eu(1,8)+skill_shares_ca_eu(1,9)))+psi_f^iota*w_ca_Fin_eu_f^(1-iota)*(skill_shares_ca_eu(1,9)/(skill_shares_ca_eu(1,8)+skill_shares_ca_eu(1,9))));
hshare_ca_Fin_eu_f=psi_f^iota*w_ca_Fin_eu_f^(1-iota)/(psi_s^iota*w_ca_Fin_eu_s^(1-iota)*(skill_shares_ca_eu(1,8)/(skill_shares_ca_eu(1,8)+skill_shares_ca_eu(1,9)))+psi_f^iota*w_ca_Fin_eu_f^(1-iota)*(skill_shares_ca_eu(1,9)/(skill_shares_ca_eu(1,8)+skill_shares_ca_eu(1,9))));


hshare_ca_Fin_us_d=psi_d^lambda*w_ca_Fin_us_d^(1-lambda)/(psi_d^lambda*w_ca_Fin_us_d^(1-lambda)*skill_shares_ca_us(1,7)+psi_f^lambda*costfs_ca_Fin_us^(1-lambda)*(skill_shares_ca_us(1,9)+skill_shares_ca_us(1,8)));
hshare_ca_Fin_us_fs=psi_d^lambda*costfs_ca_Fin_us^(1-lambda)/(psi_d^lambda*w_ca_Fin_us_d^(1-lambda)*skill_shares_ca_us(1,7)+psi_f^lambda*costfs_ca_Fin_us^(1-lambda)*(skill_shares_ca_us(1,9)+skill_shares_ca_us(1,8)));

hshare_ca_Fin_us_s=psi_s^iota*w_ca_Fin_us_s^(1-iota)/(psi_s^iota*w_ca_Fin_us_s^(1-iota)*(skill_shares_ca_us(1,8)/(skill_shares_ca_us(1,8)+skill_shares_ca_us(1,9)))+psi_f^iota*w_ca_Fin_us_f^(1-iota)*(skill_shares_ca_us(1,9)/(skill_shares_ca_us(1,8)+skill_shares_ca_us(1,9))));
hshare_ca_Fin_us_f=psi_f^iota*w_ca_Fin_us_f^(1-iota)/(psi_s^iota*w_ca_Fin_us_s^(1-iota)*(skill_shares_ca_us(1,8)/(skill_shares_ca_us(1,8)+skill_shares_ca_us(1,9)))+psi_f^iota*w_ca_Fin_us_f^(1-iota)*(skill_shares_ca_us(1,9)/(skill_shares_ca_us(1,8)+skill_shares_ca_us(1,9))));


hshare_ca_Fin_ch_d=psi_d^lambda*w_ca_Fin_ch_d^(1-lambda)/(psi_d^lambda*w_ca_Fin_ch_d^(1-lambda)*skill_shares_ca_ch(1,7)+psi_f^lambda*costfs_ca_Fin_ch^(1-lambda)*(skill_shares_ca_ch(1,9)+skill_shares_ca_ch(1,8)));
hshare_ca_Fin_ch_fs=psi_d^lambda*costfs_ca_Fin_ch^(1-lambda)/(psi_d^lambda*w_ca_Fin_ch_d^(1-lambda)*skill_shares_ca_ch(1,7)+psi_f^lambda*costfs_ca_Fin_ch^(1-lambda)*(skill_shares_ca_ch(1,9)+skill_shares_ca_ch(1,8)));

hshare_ca_Fin_ch_s=psi_s^iota*w_ca_Fin_ch_s^(1-iota)/(psi_s^iota*w_ca_Fin_ch_s^(1-iota)*(skill_shares_ca_ch(1,8)/(skill_shares_ca_ch(1,8)+skill_shares_ca_ch(1,9)))+psi_f^iota*w_ca_Fin_ch_f^(1-iota)*(skill_shares_ca_ch(1,9)/(skill_shares_ca_ch(1,8)+skill_shares_ca_ch(1,9))));
hshare_ca_Fin_ch_f=psi_f^iota*w_ca_Fin_ch_f^(1-iota)/(psi_s^iota*w_ca_Fin_ch_s^(1-iota)*(skill_shares_ca_ch(1,8)/(skill_shares_ca_ch(1,8)+skill_shares_ca_ch(1,9)))+psi_f^iota*w_ca_Fin_ch_f^(1-iota)*(skill_shares_ca_ch(1,9)/(skill_shares_ca_ch(1,8)+skill_shares_ca_ch(1,9))));


%High-skill Labor supply

%US

h_us_IT_us_d=mig_us_IT_us_us^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa);
h_us_IT_us_f=mig_in_IT_us_us^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa)*Foreign_IT_us_us(1,1)+mig_eu_IT_us_us^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa)*Foreign_IT_us_us(1,2)+...
    mig_ca_IT_us_us^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa)*Foreign_IT_us_us(1,3)+mig_ch_IT_us_us^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa)*Foreign_IT_us_us(1,4)+...
    mig_ot_IT_us_us^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_us_us(1,5);

h_us_IT_in_d=mig_us_IT_us_in^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa);
h_us_IT_in_s=mig_in_IT_us_in^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa);
h_us_IT_in_f=mig_eu_IT_us_in^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa)*Foreign_IT_us_in(1,1)+mig_ca_IT_us_in^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa)*Foreign_IT_us_in(1,2)+...
    mig_ch_IT_us_in^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa)*Foreign_IT_us_in(1,3)+mig_ot_IT_us_in^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_us_in(1,4);

h_us_IT_eu_d=mig_us_IT_us_eu^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa);
h_us_IT_eu_s=mig_eu_IT_us_eu^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa);
h_us_IT_eu_f=mig_in_IT_us_eu^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa)*Foreign_IT_us_eu(1,1)+mig_ca_IT_us_eu^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa)*Foreign_IT_us_eu(1,2)+...
    mig_ch_IT_us_eu^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa)*Foreign_IT_us_eu(1,3)+mig_ot_IT_us_eu^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_us_eu(1,4);

h_us_IT_ca_d=mig_us_IT_us_ca^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa);
h_us_IT_ca_s=mig_ca_IT_us_ca^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa);
h_us_IT_ca_f=mig_in_IT_us_ca^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa)*Foreign_IT_us_ca(1,1)+mig_eu_IT_us_ca^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa)*Foreign_IT_us_ca(1,2)+...
    mig_ch_IT_us_ca^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa)*Foreign_IT_us_ca(1,3)+mig_ot_IT_us_ca^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_us_ca(1,4);

h_us_IT_ch_d=mig_us_IT_us_ch^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa);
h_us_IT_ch_s=mig_ch_IT_us_ch^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa);
h_us_IT_ch_f=mig_in_IT_us_ch^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa)*Foreign_IT_us_ch(1,1)+mig_eu_IT_us_ch^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa)*Foreign_IT_us_ch(1,2)+...
    mig_ca_IT_us_ch^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa)*Foreign_IT_us_ch(1,3)+mig_ot_IT_us_ch^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_us_ch(1,4);




h_us_Man_us_d=mig_us_Man_us_us^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa);
h_us_Man_us_f=mig_in_Man_us_us^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa)*Foreign_Man_us_us(1,1)+mig_eu_Man_us_us^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa)*Foreign_Man_us_us(1,2)+...
    mig_ca_Man_us_us^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa)*Foreign_Man_us_us(1,3)+mig_ch_Man_us_us^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa)*Foreign_Man_us_us(1,4)+...
    mig_ot_Man_us_us^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_us_us(1,5);

h_us_Man_in_d=mig_us_Man_us_in^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa);
h_us_Man_in_s=mig_in_Man_us_in^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa);
h_us_Man_in_f=mig_eu_Man_us_in^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa)*Foreign_Man_us_in(1,1)+mig_ca_Man_us_in^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa)*Foreign_Man_us_in(1,2)+...
    mig_ch_Man_us_in^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa)*Foreign_Man_us_in(1,3)+mig_ot_Man_us_in^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_us_in(1,4);

h_us_Man_eu_d=mig_us_Man_us_eu^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa);
h_us_Man_eu_s=mig_eu_Man_us_eu^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa);
h_us_Man_eu_f=mig_in_Man_us_eu^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa)*Foreign_Man_us_eu(1,1)+mig_ca_Man_us_eu^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa)*Foreign_Man_us_eu(1,2)+...
    mig_ch_Man_us_eu^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa)*Foreign_Man_us_eu(1,3)+mig_ot_Man_us_eu^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_us_eu(1,4);

h_us_Man_ca_d=mig_us_Man_us_ca^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa);
h_us_Man_ca_s=mig_ca_Man_us_ca^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa);
h_us_Man_ca_f=mig_in_Man_us_ca^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa)*Foreign_Man_us_ca(1,1)+mig_eu_Man_us_ca^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa)*Foreign_Man_us_ca(1,2)+...
    mig_ch_Man_us_ca^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa)*Foreign_Man_us_ca(1,3)+mig_ot_Man_us_ca^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_us_ca(1,4);

h_us_Man_ch_d=mig_us_Man_us_ch^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa);
h_us_Man_ch_s=mig_ch_Man_us_ch^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa);
h_us_Man_ch_f=mig_in_Man_us_ch^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa)*Foreign_Man_us_ch(1,1)+mig_eu_Man_us_ch^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa)*Foreign_Man_us_ch(1,2)+...
    mig_ca_Man_us_ch^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa)*Foreign_Man_us_ch(1,3)+mig_ot_Man_us_ch^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_us_ch(1,4);

h_us_Oth_us_d=mig_us_Oth_us_us^((kappa-1)/kappa)*N_us*A_us_Oth^(1/kappa);
h_us_Oth_us_f=mig_in_Oth_us_us^((kappa-1)/kappa)*N_in*A_in_Oth^(1/kappa)*Foreign_Oth_us_us(1,1)+mig_eu_Oth_us_us^((kappa-1)/kappa)*N_eu*A_eu_Oth^(1/kappa)*Foreign_Oth_us_us(1,2)+...
    mig_ca_Oth_us_us^((kappa-1)/kappa)*N_ca*A_ca_Oth^(1/kappa)*Foreign_Oth_us_us(1,3)+mig_ch_Oth_us_us^((kappa-1)/kappa)*N_ch*A_ch_Oth^(1/kappa)*Foreign_Oth_us_us(1,4)+...
    mig_ot_Oth_us_us^((kappa-1)/kappa)*N_ot*A_ot_Oth^(1/kappa)*Foreign_Oth_us_us(1,5);


h_us_Fin_us_d=mig_us_Fin_us_us^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa);
h_us_Fin_us_f=mig_in_Fin_us_us^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa)*Foreign_Fin_us_us(1,1)+mig_eu_Fin_us_us^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa)*Foreign_Fin_us_us(1,2)+...
    mig_ca_Fin_us_us^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa)*Foreign_Fin_us_us(1,3)+mig_ch_Fin_us_us^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa)*Foreign_Fin_us_us(1,4)+...
    mig_ot_Fin_us_us^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_us_us(1,5);

h_us_Fin_in_d=mig_us_Fin_us_in^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa);
h_us_Fin_in_s=mig_in_Fin_us_in^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa);
h_us_Fin_in_f=mig_eu_Fin_us_in^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa)*Foreign_Fin_us_in(1,1)+mig_ca_Fin_us_in^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa)*Foreign_Fin_us_in(1,2)+...
    mig_ch_Fin_us_in^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa)*Foreign_Fin_us_in(1,3)+mig_ot_Fin_us_in^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_us_in(1,4);

h_us_Fin_eu_d=mig_us_Fin_us_eu^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa);
h_us_Fin_eu_s=mig_eu_Fin_us_eu^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa);
h_us_Fin_eu_f=mig_in_Fin_us_eu^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa)*Foreign_Fin_us_eu(1,1)+mig_ca_Fin_us_eu^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa)*Foreign_Fin_us_eu(1,2)+...
    mig_ch_Fin_us_eu^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa)*Foreign_Fin_us_eu(1,3)+mig_ot_Fin_us_eu^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_us_eu(1,4);

h_us_Fin_ca_d=mig_us_Fin_us_ca^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa);
h_us_Fin_ca_s=mig_ca_Fin_us_ca^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa);
h_us_Fin_ca_f=mig_in_Fin_us_ca^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa)*Foreign_Fin_us_ca(1,1)+mig_eu_Fin_us_ca^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa)*Foreign_Fin_us_ca(1,2)+...
    mig_ch_Fin_us_ca^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa)*Foreign_Fin_us_ca(1,3)+mig_ot_Fin_us_ca^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_us_ca(1,4);

h_us_Fin_ch_d=mig_us_Fin_us_ch^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa);
h_us_Fin_ch_s=mig_ch_Fin_us_ch^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa);
h_us_Fin_ch_f=mig_in_Fin_us_ch^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa)*Foreign_Fin_us_ch(1,1)+mig_eu_Fin_us_ch^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa)*Foreign_Fin_us_ch(1,2)+...
    mig_ca_Fin_us_ch^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa)*Foreign_Fin_us_ch(1,3)+mig_ot_Fin_us_ch^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_us_ch(1,4);

%Europe

h_eu_IT_eu_d=mig_eu_IT_eu_eu^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa);
h_eu_IT_eu_f=mig_in_IT_eu_eu^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa)*Foreign_IT_eu_eu(1,1)+mig_us_IT_eu_eu^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa)*Foreign_IT_eu_eu(1,2)+...
    mig_ca_IT_eu_eu^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa)*Foreign_IT_eu_eu(1,3)+mig_ch_IT_eu_eu^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa)*Foreign_IT_eu_eu(1,4)+...
    mig_ot_IT_eu_eu^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_eu_eu(1,5);

h_eu_IT_in_d=mig_eu_IT_eu_in^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa);
h_eu_IT_in_s=mig_in_IT_eu_in^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa);
h_eu_IT_in_f=mig_us_IT_eu_in^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa)*Foreign_IT_eu_in(1,1)+mig_ca_IT_eu_in^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa)*Foreign_IT_eu_in(1,2)+...
    mig_ch_IT_eu_in^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa)*Foreign_IT_eu_in(1,3)+mig_ot_IT_eu_in^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_eu_in(1,4);

h_eu_IT_us_d=mig_eu_IT_eu_us^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa);
h_eu_IT_us_s=mig_us_IT_eu_us^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa);
h_eu_IT_us_f=mig_in_IT_eu_us^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa)*Foreign_IT_eu_us(1,1)+mig_ca_IT_eu_us^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa)*Foreign_IT_eu_us(1,2)+...
    mig_ch_IT_eu_us^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa)*Foreign_IT_eu_us(1,3)+mig_ot_IT_eu_us^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_eu_us(1,4);

h_eu_IT_ca_d=mig_eu_IT_eu_ca^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa);
h_eu_IT_ca_s=mig_ca_IT_eu_ca^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa);
h_eu_IT_ca_f=mig_in_IT_eu_ca^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa)*Foreign_IT_eu_ca(1,1)+mig_us_IT_eu_ca^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa)*Foreign_IT_eu_ca(1,2)+...
    mig_ch_IT_eu_ca^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa)*Foreign_IT_eu_ca(1,3)+mig_ot_IT_eu_ca^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_eu_ca(1,4);

h_eu_IT_ch_d=mig_eu_IT_eu_ch^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa);
h_eu_IT_ch_s=mig_ch_IT_eu_ch^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa);
h_eu_IT_ch_f=mig_in_IT_eu_ch^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa)*Foreign_IT_eu_ch(1,1)+mig_us_IT_eu_ch^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa)*Foreign_IT_eu_ch(1,2)+...
    mig_ca_IT_eu_ch^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa)*Foreign_IT_eu_ch(1,3)+mig_ot_IT_eu_ch^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_eu_ch(1,4);


h_eu_Man_eu_d=mig_eu_Man_eu_eu^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa);
h_eu_Man_eu_f=mig_in_Man_eu_eu^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa)*Foreign_Man_eu_eu(1,1)+mig_us_Man_eu_eu^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa)*Foreign_Man_eu_eu(1,2)+...
    mig_ca_Man_eu_eu^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa)*Foreign_Man_eu_eu(1,3)+mig_ch_Man_eu_eu^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa)*Foreign_Man_eu_eu(1,4)+...
    mig_ot_Man_eu_eu^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_eu_eu(1,5);

h_eu_Man_in_d=mig_eu_Man_eu_in^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa);
h_eu_Man_in_s=mig_in_Man_eu_in^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa);
h_eu_Man_in_f=mig_us_Man_eu_in^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa)*Foreign_Man_eu_in(1,1)+mig_ca_Man_eu_in^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa)*Foreign_Man_eu_in(1,2)+...
    mig_ch_Man_eu_in^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa)*Foreign_Man_eu_in(1,3)+mig_ot_Man_eu_in^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_eu_in(1,4);

h_eu_Man_us_d=mig_eu_Man_eu_us^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa);
h_eu_Man_us_s=mig_us_Man_eu_us^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa);
h_eu_Man_us_f=mig_in_Man_eu_us^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa)*Foreign_Man_eu_us(1,1)+mig_ca_Man_eu_us^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa)*Foreign_Man_eu_us(1,2)+...
    mig_ch_Man_eu_us^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa)*Foreign_Man_eu_us(1,3)+mig_ot_Man_eu_us^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_eu_us(1,4);

h_eu_Man_ca_d=mig_eu_Man_eu_ca^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa);
h_eu_Man_ca_s=mig_ca_Man_eu_ca^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa);
h_eu_Man_ca_f=mig_in_Man_eu_ca^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa)*Foreign_Man_eu_ca(1,1)+mig_us_Man_eu_ca^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa)*Foreign_Man_eu_ca(1,2)+...
    mig_ch_Man_eu_ca^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa)*Foreign_Man_eu_ca(1,3)+mig_ot_Man_eu_ca^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_eu_ca(1,4);

h_eu_Man_ch_d=mig_eu_Man_eu_ch^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa);
h_eu_Man_ch_s=mig_ch_Man_eu_ch^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa);
h_eu_Man_ch_f=mig_in_Man_eu_ch^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa)*Foreign_Man_eu_ch(1,1)+mig_us_Man_eu_ch^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa)*Foreign_Man_eu_ch(1,2)+...
    mig_ca_Man_eu_ch^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa)*Foreign_Man_eu_ch(1,3)+mig_ot_Man_eu_ch^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_eu_ch(1,4);

h_eu_Oth_eu_d=mig_eu_Oth_eu_eu^((kappa-1)/kappa)*N_eu*A_eu_Oth^(1/kappa);
h_eu_Oth_eu_f=mig_in_Oth_eu_eu^((kappa-1)/kappa)*N_in*A_in_Oth^(1/kappa)*Foreign_Oth_eu_eu(1,1)+mig_us_Oth_eu_eu^((kappa-1)/kappa)*N_us*A_us_Oth^(1/kappa)*Foreign_Oth_eu_eu(1,2)+...
    mig_ca_Oth_eu_eu^((kappa-1)/kappa)*N_ca*A_ca_Oth^(1/kappa)*Foreign_Oth_eu_eu(1,3)+mig_ch_Oth_eu_eu^((kappa-1)/kappa)*N_ch*A_ch_Oth^(1/kappa)*Foreign_Oth_eu_eu(1,4)+...
    mig_ot_Oth_eu_eu^((kappa-1)/kappa)*N_ot*A_ot_Oth^(1/kappa)*Foreign_Oth_eu_eu(1,5);

h_eu_Fin_eu_d=mig_eu_Fin_eu_eu^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa);
h_eu_Fin_eu_f=mig_in_Fin_eu_eu^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa)*Foreign_Fin_eu_eu(1,1)+mig_us_Fin_eu_eu^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa)*Foreign_Fin_eu_eu(1,2)+...
    mig_ca_Fin_eu_eu^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa)*Foreign_Fin_eu_eu(1,3)+mig_ch_Fin_eu_eu^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa)*Foreign_Fin_eu_eu(1,4)+...
    mig_ot_Fin_eu_eu^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_eu_eu(1,5);

h_eu_Fin_in_d=mig_eu_Fin_eu_in^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa);
h_eu_Fin_in_s=mig_in_Fin_eu_in^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa);
h_eu_Fin_in_f=mig_us_Fin_eu_in^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa)*Foreign_Fin_eu_in(1,1)+mig_ca_Fin_eu_in^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa)*Foreign_Fin_eu_in(1,2)+...
    mig_ch_Fin_eu_in^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa)*Foreign_Fin_eu_in(1,3)+mig_ot_Fin_eu_in^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_eu_in(1,4);

h_eu_Fin_us_d=mig_eu_Fin_eu_us^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa);
h_eu_Fin_us_s=mig_us_Fin_eu_us^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa);
h_eu_Fin_us_f=mig_in_Fin_eu_us^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa)*Foreign_Fin_eu_us(1,1)+mig_ca_Fin_eu_us^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa)*Foreign_Fin_eu_us(1,2)+...
    mig_ch_Fin_eu_us^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa)*Foreign_Fin_eu_us(1,3)+mig_ot_Fin_eu_us^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_eu_us(1,4);

h_eu_Fin_ca_d=mig_eu_Fin_eu_ca^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa);
h_eu_Fin_ca_s=mig_ca_Fin_eu_ca^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa);
h_eu_Fin_ca_f=mig_in_Fin_eu_ca^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa)*Foreign_Fin_eu_ca(1,1)+mig_us_Fin_eu_ca^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa)*Foreign_Fin_eu_ca(1,2)+...
    mig_ch_Fin_eu_ca^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa)*Foreign_Fin_eu_ca(1,3)+mig_ot_Fin_eu_ca^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_eu_ca(1,4);

h_eu_Fin_ch_d=mig_eu_Fin_eu_ch^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa);
h_eu_Fin_ch_s=mig_ch_Fin_eu_ch^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa);
h_eu_Fin_ch_f=mig_in_Fin_eu_ch^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa)*Foreign_Fin_eu_ch(1,1)+mig_us_Fin_eu_ch^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa)*Foreign_Fin_eu_ch(1,2)+...
    mig_ca_Fin_eu_ch^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa)*Foreign_Fin_eu_ch(1,3)+mig_ot_Fin_eu_ch^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_eu_ch(1,4);


%Canada

h_ca_IT_ca_d=mig_ca_IT_ca_ca^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa);
h_ca_IT_ca_f=mig_in_IT_ca_ca^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa)*Foreign_IT_ca_ca(1,1)+mig_eu_IT_ca_ca^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa)*Foreign_IT_ca_ca(1,2)+...
    mig_us_IT_ca_ca^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa)*Foreign_IT_ca_ca(1,3)+mig_ch_IT_ca_ca^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa)*Foreign_IT_ca_ca(1,4)+...
    mig_ot_IT_ca_ca^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_ca_ca(1,5);

h_ca_IT_in_d=mig_ca_IT_ca_in^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa);
h_ca_IT_in_s=mig_in_IT_ca_in^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa);
h_ca_IT_in_f=mig_eu_IT_ca_in^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa)*Foreign_IT_ca_in(1,1)+mig_us_IT_ca_in^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa)*Foreign_IT_ca_in(1,2)+...
    mig_ch_IT_ca_in^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa)*Foreign_IT_ca_in(1,3)+mig_ot_IT_ca_in^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_ca_in(1,4);

h_ca_IT_us_d=mig_ca_IT_ca_us^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa);
h_ca_IT_us_s=mig_us_IT_ca_us^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa);
h_ca_IT_us_f=mig_in_IT_ca_us^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa)*Foreign_IT_ca_us(1,1)+mig_eu_IT_ca_us^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa)*Foreign_IT_ca_us(1,2)+...
    mig_ch_IT_ca_us^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa)*Foreign_IT_ca_us(1,3)+mig_ot_IT_ca_us^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_ca_us(1,4);

h_ca_IT_eu_d=mig_ca_IT_ca_eu^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa);
h_ca_IT_eu_s=mig_eu_IT_ca_eu^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa);
h_ca_IT_eu_f=mig_in_IT_ca_eu^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa)*Foreign_IT_ca_eu(1,1)+mig_us_IT_ca_eu^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa)*Foreign_IT_ca_eu(1,2)+...
    mig_ch_IT_ca_eu^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa)*Foreign_IT_ca_eu(1,3)+mig_ot_IT_ca_eu^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_ca_eu(1,4);

h_ca_IT_ch_d=mig_ca_IT_ca_ch^((kappa-1)/kappa)*N_ca*A_ca_IT^(1/kappa);
h_ca_IT_ch_s=mig_ch_IT_ca_ch^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa);
h_ca_IT_ch_f=mig_in_IT_ca_ch^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa)*Foreign_IT_ca_ch(1,1)+mig_us_IT_ca_ch^((kappa-1)/kappa)*N_us*A_us_IT^(1/kappa)*Foreign_IT_ca_ch(1,3)+...
    mig_eu_IT_ca_ch^((kappa-1)/kappa)*N_eu*A_eu_IT^(1/kappa)*Foreign_IT_ca_ch(1,2)+mig_ot_IT_ca_ch^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa)*Foreign_IT_ca_ch(1,4);


h_ca_Man_ca_d=mig_ca_Man_ca_ca^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa);
h_ca_Man_ca_f=mig_in_Man_ca_ca^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa)*Foreign_Man_ca_ca(1,1)+mig_eu_Man_ca_ca^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa)*Foreign_Man_ca_ca(1,2)+...
    mig_us_Man_ca_ca^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa)*Foreign_Man_ca_ca(1,3)+mig_ch_Man_ca_ca^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa)*Foreign_Man_ca_ca(1,4)+...
    mig_ot_Man_ca_ca^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_ca_ca(1,5);

h_ca_Man_in_d=mig_ca_Man_ca_in^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa);
h_ca_Man_in_s=mig_in_Man_ca_in^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa);
h_ca_Man_in_f=mig_eu_Man_ca_in^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa)*Foreign_Man_ca_in(1,1)+mig_us_Man_ca_in^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa)*Foreign_Man_ca_in(1,2)+...
    mig_ch_Man_ca_in^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa)*Foreign_Man_ca_in(1,3)+mig_ot_Man_ca_in^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_ca_in(1,4);

h_ca_Man_us_d=mig_ca_Man_ca_us^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa);
h_ca_Man_us_s=mig_us_Man_ca_us^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa);
h_ca_Man_us_f=mig_in_Man_ca_us^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa)*Foreign_Man_ca_us(1,1)+mig_eu_Man_ca_us^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa)*Foreign_Man_ca_us(1,2)+...
    mig_ch_Man_ca_us^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa)*Foreign_Man_ca_us(1,3)+mig_ot_Man_ca_us^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_ca_us(1,4);

h_ca_Man_eu_d=mig_ca_Man_ca_eu^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa);
h_ca_Man_eu_s=mig_eu_Man_ca_eu^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa);
h_ca_Man_eu_f=mig_in_Man_ca_eu^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa)*Foreign_Man_ca_eu(1,1)+mig_us_Man_ca_eu^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa)*Foreign_Man_ca_eu(1,2)+...
    mig_ch_Man_ca_eu^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa)*Foreign_Man_ca_eu(1,3)+mig_ot_Man_ca_eu^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_ca_eu(1,4);

h_ca_Man_ch_d=mig_ca_Man_ca_ch^((kappa-1)/kappa)*N_ca*A_ca_Man^(1/kappa);
h_ca_Man_ch_s=mig_ch_Man_ca_ch^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa);
h_ca_Man_ch_f=mig_in_Man_ca_ch^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa)*Foreign_Man_ca_ch(1,1)+mig_us_Man_ca_ch^((kappa-1)/kappa)*N_us*A_us_Man^(1/kappa)*Foreign_Man_ca_ch(1,3)+...
    mig_eu_Man_ca_ch^((kappa-1)/kappa)*N_eu*A_eu_Man^(1/kappa)*Foreign_Man_ca_ch(1,2)+mig_ot_Man_ca_ch^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa)*Foreign_Man_ca_ch(1,4);

h_ca_Oth_ca_d=mig_ca_Oth_ca_ca^((kappa-1)/kappa)*N_ca*A_ca_Oth^(1/kappa);
h_ca_Oth_ca_f=mig_in_Oth_ca_ca^((kappa-1)/kappa)*N_in*A_in_Oth^(1/kappa)*Foreign_Oth_ca_ca(1,1)+mig_eu_Oth_ca_ca^((kappa-1)/kappa)*N_eu*A_eu_Oth^(1/kappa)*Foreign_Oth_ca_ca(1,2)+...
    mig_us_Oth_ca_ca^((kappa-1)/kappa)*N_us*A_us_Oth^(1/kappa)*Foreign_Oth_ca_ca(1,3)+mig_ch_Oth_ca_ca^((kappa-1)/kappa)*N_ch*A_ch_Oth^(1/kappa)*Foreign_Oth_ca_ca(1,4)+...
    mig_ot_Oth_ca_ca^((kappa-1)/kappa)*N_ot*A_ot_Oth^(1/kappa)*Foreign_Oth_ca_ca(1,5);

h_ca_Fin_ca_d=mig_ca_Fin_ca_ca^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa);
h_ca_Fin_ca_f=mig_in_Fin_ca_ca^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa)*Foreign_Fin_ca_ca(1,1)+mig_eu_Fin_ca_ca^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa)*Foreign_Fin_ca_ca(1,2)+...
    mig_us_Fin_ca_ca^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa)*Foreign_Fin_ca_ca(1,3)+mig_ch_Fin_ca_ca^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa)*Foreign_Fin_ca_ca(1,4)+...
    mig_ot_Fin_ca_ca^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_ca_ca(1,5);

h_ca_Fin_in_d=mig_ca_Fin_ca_in^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa);
h_ca_Fin_in_s=mig_in_Fin_ca_in^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa);
h_ca_Fin_in_f=mig_eu_Fin_ca_in^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa)*Foreign_Fin_ca_in(1,1)+mig_us_Fin_ca_in^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa)*Foreign_Fin_ca_in(1,2)+...
    mig_ch_Fin_ca_in^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa)*Foreign_Fin_ca_in(1,3)+mig_ot_Fin_ca_in^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_ca_in(1,4);

h_ca_Fin_us_d=mig_ca_Fin_ca_us^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa);
h_ca_Fin_us_s=mig_us_Fin_ca_us^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa);
h_ca_Fin_us_f=mig_in_Fin_ca_us^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa)*Foreign_Fin_ca_us(1,1)+mig_eu_Fin_ca_us^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa)*Foreign_Fin_ca_us(1,2)+...
    mig_ch_Fin_ca_us^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa)*Foreign_Fin_ca_us(1,3)+mig_ot_Fin_ca_us^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_ca_us(1,4);

h_ca_Fin_eu_d=mig_ca_Fin_ca_eu^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa);
h_ca_Fin_eu_s=mig_eu_Fin_ca_eu^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa);
h_ca_Fin_eu_f=mig_in_Fin_ca_eu^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa)*Foreign_Fin_ca_eu(1,1)+mig_us_Fin_ca_eu^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa)*Foreign_Fin_ca_eu(1,2)+...
    mig_ch_Fin_ca_eu^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa)*Foreign_Fin_ca_eu(1,3)+mig_ot_Fin_ca_eu^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_ca_eu(1,4);

h_ca_Fin_ch_d=mig_ca_Fin_ca_ch^((kappa-1)/kappa)*N_ca*A_ca_Fin^(1/kappa);
h_ca_Fin_ch_s=mig_ch_Fin_ca_ch^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa);
h_ca_Fin_ch_f=mig_in_Fin_ca_ch^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa)*Foreign_Fin_ca_ch(1,1)+mig_us_Fin_ca_ch^((kappa-1)/kappa)*N_us*A_us_Fin^(1/kappa)*Foreign_Fin_ca_ch(1,3)+...
    mig_eu_Fin_ca_ch^((kappa-1)/kappa)*N_eu*A_eu_Fin^(1/kappa)*Foreign_Fin_ca_ch(1,2)+mig_ot_Fin_ca_ch^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa)*Foreign_Fin_ca_ch(1,4);

%India

h_in_IT_us=mig_in_IT_in_us^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa);
h_in_IT_in=mig_in_IT_in_in^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa);
h_in_IT_eu=mig_in_IT_in_eu^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa);
h_in_IT_ca=mig_in_IT_in_ca^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa);
h_in_IT_ch=mig_in_IT_in_ch^((kappa-1)/kappa)*N_in*A_in_IT^(1/kappa);


h_in_Man_us=mig_in_Man_in_us^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa);
h_in_Man_in=mig_in_Man_in_in^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa);
h_in_Man_eu=mig_in_Man_in_eu^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa);
h_in_Man_ca=mig_in_Man_in_ca^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa);
h_in_Man_ch=mig_in_Man_in_ch^((kappa-1)/kappa)*N_in*A_in_Man^(1/kappa);

h_in_Oth_in=mig_in_Oth_in_in^((kappa-1)/kappa)*N_in*A_in_Oth^(1/kappa);

h_in_Fin_us=mig_in_Fin_in_us^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa);
h_in_Fin_in=mig_in_Fin_in_in^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa);
h_in_Fin_eu=mig_in_Fin_in_eu^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa);
h_in_Fin_ca=mig_in_Fin_in_ca^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa);
h_in_Fin_ch=mig_in_Fin_in_ch^((kappa-1)/kappa)*N_in*A_in_Fin^(1/kappa);

%China


h_ch_IT_us=mig_ch_IT_ch_us^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa);
h_ch_IT_in=mig_ch_IT_ch_in^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa);
h_ch_IT_eu=mig_ch_IT_ch_eu^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa);
h_ch_IT_ca=mig_ch_IT_ch_ca^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa);
h_ch_IT_ch=mig_ch_IT_ch_ch^((kappa-1)/kappa)*N_ch*A_ch_IT^(1/kappa);


h_ch_Man_us=mig_ch_Man_ch_us^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa);
h_ch_Man_in=mig_ch_Man_ch_in^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa);
h_ch_Man_eu=mig_ch_Man_ch_eu^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa);
h_ch_Man_ca=mig_ch_Man_ch_ca^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa);
h_ch_Man_ch=mig_ch_Man_ch_ch^((kappa-1)/kappa)*N_ch*A_ch_Man^(1/kappa);

h_ch_Oth_ch=mig_ch_Oth_ch_ch^((kappa-1)/kappa)*N_ch*A_ch_Oth^(1/kappa);

h_ch_Fin_us=mig_ch_Fin_ch_us^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa);
h_ch_Fin_in=mig_ch_Fin_ch_in^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa);
h_ch_Fin_eu=mig_ch_Fin_ch_eu^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa);
h_ch_Fin_ca=mig_ch_Fin_ch_ca^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa);
h_ch_Fin_ch=mig_ch_Fin_ch_ch^((kappa-1)/kappa)*N_ch*A_ch_Fin^(1/kappa);


%Other

h_ot_IT_ot=mig_ot_IT_ot_ot^((kappa-1)/kappa)*N_ot*A_ot_IT^(1/kappa);
h_ot_Man_ot=mig_ot_Man_ot_ot^((kappa-1)/kappa)*N_ot*A_ot_Man^(1/kappa);
h_ot_Oth_ot=mig_ot_Oth_ot_ot^((kappa-1)/kappa)*N_ot*A_ot_Oth^(1/kappa);
h_ot_Fin_ot=mig_ot_Fin_ot_ot^((kappa-1)/kappa)*N_ot*A_ot_Fin^(1/kappa);




%Technology by location-industry

Ttil_us_IT=T_us_IT*(cost_us_IT_us)^(-theta)*MNE_shares_IT_us(1,1)+T_in_IT*(cost_us_IT_in*delta_us_in_IT)^(-theta)*MNE_shares_IT_us(1,2)+...
    T_eu_IT*(cost_us_IT_eu*delta_us_eu_IT)^(-theta)*MNE_shares_IT_us(1,3)+T_ca_IT*(cost_us_IT_ca*delta_us_ca_IT)^(-theta)*MNE_shares_IT_us(1,4)+T_ch_IT*(cost_us_IT_ch*delta_us_ch_IT)^(-theta)*MNE_shares_IT_us(1,5);
Ttil_us_Man=T_us_Man*(cost_us_Man_us)^(-theta)*MNE_shares_Man_us(1,1)+T_in_Man*(cost_us_Man_in*delta_us_in_Man)^(-theta)*MNE_shares_Man_us(1,2)+...
    T_eu_Man*(cost_us_Man_eu*delta_us_eu_Man)^(-theta)*MNE_shares_Man_us(1,3)+T_ca_Man*(cost_us_Man_ca*delta_us_ca_Man)^(-theta)*MNE_shares_Man_us(1,4)+T_ch_Man*(cost_us_Man_ch*delta_us_ch_Man)^(-theta)*MNE_shares_Man_us(1,5);
Ttil_us_Oth=T_us_Oth*(cost_us_Oth_us)^(-theta);
Ttil_us_Fin=T_us_Fin*(cost_us_Fin_us)^(-theta)*MNE_shares_Fin_us(1,1)+T_in_Fin*(cost_us_Fin_in*delta_us_in_Fin)^(-theta)*MNE_shares_Fin_us(1,2)+...
    T_eu_Fin*(cost_us_Fin_eu*delta_us_eu_Fin)^(-theta)*MNE_shares_Fin_us(1,3)+T_ca_Fin*(cost_us_Fin_ca*delta_us_ca_Fin)^(-theta)*MNE_shares_Fin_us(1,4)+T_ch_Fin*(cost_us_Fin_ch*delta_us_ch_Fin)^(-theta)*MNE_shares_Fin_us(1,5);


Ttil_in_IT=T_us_IT*(cost_in_IT_us*delta_in_us_IT)^(-theta)*MNE_shares_IT_in(1,1)+T_in_IT*(cost_in_IT_in)^(-theta)*MNE_shares_IT_in(1,2)+...
    T_eu_IT*(cost_in_IT_eu*delta_in_eu_IT)^(-theta)*MNE_shares_IT_in(1,3)+T_ca_IT*(cost_in_IT_ca*delta_in_ca_IT)^(-theta)*MNE_shares_IT_in(1,4)+T_ch_IT*(cost_in_IT_ch*delta_in_ch_IT)^(-theta)*MNE_shares_IT_in(1,5);
Ttil_in_Man=T_us_Man*(cost_in_Man_us*delta_in_us_Man)^(-theta)*MNE_shares_Man_in(1,1)+T_in_Man*(cost_in_Man_in)^(-theta)*MNE_shares_Man_in(1,2)+...
    T_eu_Man*(cost_in_Man_eu*delta_in_eu_Man)^(-theta)*MNE_shares_Man_in(1,3)+T_ca_Man*(cost_in_Man_ca*delta_in_ca_Man)^(-theta)*MNE_shares_Man_in(1,4)+T_ch_Man*(cost_in_Man_ch*delta_in_ch_Man)^(-theta)*MNE_shares_Man_in(1,5);
Ttil_in_Oth=T_in_Oth*(cost_in_Oth_in)^(-theta);
Ttil_in_Fin=T_us_Fin*(cost_in_Fin_us*delta_in_us_Fin)^(-theta)*MNE_shares_Fin_in(1,1)+T_in_Fin*(cost_in_Fin_in)^(-theta)*MNE_shares_Fin_in(1,2)+...
    T_eu_Fin*(cost_in_Fin_eu*delta_in_eu_Fin)^(-theta)*MNE_shares_Fin_in(1,3)+T_ca_Fin*(cost_in_Fin_ca*delta_in_ca_Fin)^(-theta)*MNE_shares_Fin_in(1,4)+T_ch_Fin*(cost_in_Fin_ch*delta_in_ch_Fin)^(-theta)*MNE_shares_Fin_in(1,5);

Ttil_eu_IT=T_us_IT*(cost_eu_IT_us*delta_eu_us_IT)^(-theta)*MNE_shares_IT_eu(1,1)+T_in_IT*(cost_eu_IT_in*delta_eu_in_IT)^(-theta)*MNE_shares_IT_eu(1,2)+...
    T_eu_IT*(cost_eu_IT_eu)^(-theta)*MNE_shares_IT_eu(1,3)+T_ca_IT*(cost_eu_IT_ca*delta_eu_ca_IT)^(-theta)*MNE_shares_IT_eu(1,4)+T_ch_IT*(cost_eu_IT_ch*delta_eu_ch_IT)^(-theta)*MNE_shares_IT_eu(1,5);
Ttil_eu_Man=T_us_Man*(cost_eu_Man_us*delta_eu_us_Man)^(-theta)*MNE_shares_Man_eu(1,1)+T_in_Man*(cost_eu_Man_in*delta_eu_in_Man)^(-theta)*MNE_shares_Man_eu(1,2)+...
    T_eu_Man*(cost_eu_Man_eu)^(-theta)*MNE_shares_Man_eu(1,3)+T_ca_Man*(cost_eu_Man_ca*delta_eu_ca_Man)^(-theta)*MNE_shares_Man_eu(1,4)+T_ch_Man*(cost_eu_Man_ch*delta_eu_ch_Man)^(-theta)*MNE_shares_Man_eu(1,5);
Ttil_eu_Oth=T_eu_Oth*(cost_eu_Oth_eu)^(-theta);
Ttil_eu_Fin=T_us_Fin*(cost_eu_Fin_us*delta_eu_us_Fin)^(-theta)*MNE_shares_Fin_eu(1,1)+T_in_Fin*(cost_eu_Fin_in*delta_eu_in_Fin)^(-theta)*MNE_shares_Fin_eu(1,2)+...
    T_eu_Fin*(cost_eu_Fin_eu)^(-theta)*MNE_shares_Fin_eu(1,3)+T_ca_Fin*(cost_eu_Fin_ca*delta_eu_ca_Fin)^(-theta)*MNE_shares_Fin_eu(1,4)+T_ch_Fin*(cost_eu_Fin_ch*delta_eu_ch_Fin)^(-theta)*MNE_shares_Fin_eu(1,5);


Ttil_ca_IT=T_us_IT*(cost_ca_IT_us*delta_ca_us_IT)^(-theta)*MNE_shares_IT_ca(1,1)+T_in_IT*(cost_ca_IT_in*delta_ca_in_IT)^(-theta)*MNE_shares_IT_ca(1,2)+...
    T_eu_IT*(cost_ca_IT_eu*delta_ca_eu_IT)^(-theta)*MNE_shares_IT_ca(1,3)+T_ca_IT*(cost_ca_IT_ca)^(-theta)*MNE_shares_IT_ca(1,4)+T_ch_IT*(cost_ca_IT_ch*delta_ca_ch_IT)^(-theta)*MNE_shares_IT_ca(1,5);
Ttil_ca_Man=T_us_Man*(cost_ca_Man_us*delta_ca_us_Man)^(-theta)*MNE_shares_Man_ca(1,1)+T_in_Man*(cost_ca_Man_in*delta_ca_in_Man)^(-theta)*MNE_shares_Man_ca(1,2)+...
    T_eu_Man*(cost_ca_Man_eu*delta_ca_eu_Man)^(-theta)*MNE_shares_Man_ca(1,3)+T_ca_Man*(cost_ca_Man_ca)^(-theta)*MNE_shares_Man_ca(1,4)+T_ch_Man*(cost_ca_Man_ch*delta_ca_ch_Man)^(-theta)*MNE_shares_Man_ca(1,5);
Ttil_ca_Oth=T_ca_Oth*(cost_ca_Oth_ca)^(-theta);
Ttil_ca_Fin=T_us_Fin*(cost_ca_Fin_us*delta_ca_us_Fin)^(-theta)*MNE_shares_Fin_ca(1,1)+T_in_Fin*(cost_ca_Fin_in*delta_ca_in_Fin)^(-theta)*MNE_shares_Fin_ca(1,2)+...
    T_eu_Fin*(cost_ca_Fin_eu*delta_ca_eu_Fin)^(-theta)*MNE_shares_Fin_ca(1,3)+T_ca_Fin*(cost_ca_Fin_ca)^(-theta)*MNE_shares_Fin_ca(1,4)+T_ch_Fin*(cost_ca_Fin_ch*delta_ca_ch_Fin)^(-theta)*MNE_shares_Fin_ca(1,5);

Ttil_ch_IT=T_us_IT*(cost_ch_IT_us*delta_ch_us_IT)^(-theta)*MNE_shares_IT_ch(1,1)+T_in_IT*(cost_ch_IT_in*delta_ch_in_IT)^(-theta)*MNE_shares_IT_ch(1,2)+...
    T_eu_IT*(cost_ch_IT_eu*delta_ch_eu_IT)^(-theta)*MNE_shares_IT_ch(1,3)+T_ca_IT*(cost_ch_IT_ca*delta_ch_ca_IT)^(-theta)*MNE_shares_IT_ch(1,4)+T_ch_IT*(cost_ch_IT_ch)^(-theta)*MNE_shares_IT_ch(1,5);
Ttil_ch_Man=T_us_Man*(cost_ch_Man_us*delta_ch_us_Man)^(-theta)*MNE_shares_Man_ch(1,1)+T_in_Man*(cost_ch_Man_in*delta_ch_in_Man)^(-theta)*MNE_shares_Man_ch(1,2)+...
    T_eu_Man*(cost_ch_Man_eu*delta_ch_eu_Man)^(-theta)*MNE_shares_Man_ch(1,3)+T_ca_Man*(cost_ch_Man_ca*delta_ch_ca_Man)^(-theta)*MNE_shares_Man_ch(1,4)+T_ch_Man*(cost_ch_Man_ch)^(-theta)*MNE_shares_Man_ch(1,5);
Ttil_ch_Oth=T_ch_Oth*(cost_ch_Oth_ch)^(-theta);
Ttil_ch_Fin=T_us_Fin*(cost_ch_Fin_us*delta_ch_us_Fin)^(-theta)*MNE_shares_Fin_ch(1,1)+T_in_Fin*(cost_ch_Fin_in*delta_ch_in_Fin)^(-theta)*MNE_shares_Fin_ch(1,2)+...
    T_eu_Fin*(cost_ch_Fin_eu*delta_ch_eu_Fin)^(-theta)*MNE_shares_Fin_ch(1,3)+T_ca_Fin*(cost_ch_Fin_ca*delta_ch_ca_Fin)^(-theta)*MNE_shares_Fin_ch(1,4)+T_ch_Fin*(cost_ch_Fin_ch)^(-theta)*MNE_shares_Fin_ch(1,5);


Ttil_ot_IT=T_ot_IT*(cost_ot_IT_ot)^(-theta);
Ttil_ot_Man=T_ot_Man*(cost_ot_Man_ot)^(-theta);
Ttil_ot_Oth=T_ot_Oth*(cost_ot_Oth_ot)^(-theta);
Ttil_ot_Fin=T_ot_Fin*(cost_ot_Fin_ot)^(-theta);



%Prices

p_us_IT=(Ttil_us_IT*Trade_shares_IT_us(1,1)+tau_us_in_IT^(-theta)*Ttil_in_IT*Trade_shares_IT_us(1,2)+tau_us_eu_IT^(-theta)*Ttil_eu_IT*Trade_shares_IT_us(1,3)+...
    tau_us_ca_IT^(-theta)*Ttil_ca_IT*Trade_shares_IT_us(1,4)+tau_us_ch_IT^(-theta)*Ttil_ch_IT*Trade_shares_IT_us(1,5)+tau_us_ot_IT^(-theta)*Ttil_ot_IT*Trade_shares_IT_us(1,6))^(-1/theta);
p_us_Man=(Ttil_us_Man*Trade_shares_Man_us(1,1)+tau_us_in_Man^(-theta)*Ttil_in_Man*Trade_shares_Man_us(1,2)+tau_us_eu_Man^(-theta)*Ttil_eu_Man*Trade_shares_Man_us(1,3)+...
    tau_us_ca_Man^(-theta)*Ttil_ca_Man*Trade_shares_Man_us(1,4)+tau_us_ch_Man^(-theta)*Ttil_ch_Man*Trade_shares_Man_us(1,5)+tau_us_ot_Man^(-theta)*Ttil_ot_Man*Trade_shares_Man_us(1,6))^(-1/theta);
p_us_Oth=(Ttil_us_Oth*Trade_shares_Oth_us(1,1)+tau_us_in_Oth^(-theta)*Ttil_in_Oth*Trade_shares_Oth_us(1,2)+tau_us_eu_Oth^(-theta)*Ttil_eu_Oth*Trade_shares_Oth_us(1,3)+...
    tau_us_ca_Oth^(-theta)*Ttil_ca_Oth*Trade_shares_Oth_us(1,4)+tau_us_ch_Oth^(-theta)*Ttil_ch_Oth*Trade_shares_Oth_us(1,5)+tau_us_ot_Oth^(-theta)*Ttil_ot_Oth*Trade_shares_Oth_us(1,6))^(-1/theta);
p_us_Fin=(Ttil_us_Fin*Trade_shares_Fin_us(1,1)+tau_us_in_Fin^(-theta)*Ttil_in_Fin*Trade_shares_Fin_us(1,2)+tau_us_eu_Fin^(-theta)*Ttil_eu_Fin*Trade_shares_Fin_us(1,3)+...
    tau_us_ca_Fin^(-theta)*Ttil_ca_Fin*Trade_shares_Fin_us(1,4)+tau_us_ch_Fin^(-theta)*Ttil_ch_Fin*Trade_shares_Fin_us(1,5)+tau_us_ot_Fin^(-theta)*Ttil_ot_Fin*Trade_shares_Fin_us(1,6))^(-1/theta);

p_in_IT=(tau_in_us_IT^(-theta)*Ttil_us_IT*Trade_shares_IT_in(1,1)+Ttil_in_IT*Trade_shares_IT_in(1,2)+tau_in_eu_IT^(-theta)*Ttil_eu_IT*Trade_shares_IT_in(1,3)+...
    tau_in_ca_IT^(-theta)*Ttil_ca_IT*Trade_shares_IT_in(1,4)+tau_in_ch_IT^(-theta)*Ttil_ch_IT*Trade_shares_IT_in(1,5)+tau_in_ot_IT^(-theta)*Ttil_ot_IT*Trade_shares_IT_in(1,6))^(-1/theta);
p_in_Man=(tau_in_us_Man^(-theta)*Ttil_us_Man*Trade_shares_Man_in(1,1)+Ttil_in_Man*Trade_shares_Man_in(1,2)+tau_in_eu_Man^(-theta)*Ttil_eu_Man*Trade_shares_Man_in(1,3)+...
    tau_in_ca_Man^(-theta)*Ttil_ca_Man*Trade_shares_Man_in(1,4)+tau_in_ch_Man^(-theta)*Ttil_ch_Man*Trade_shares_Man_in(1,5)+tau_in_ot_Man^(-theta)*Ttil_ot_Man*Trade_shares_Man_in(1,6))^(-1/theta);
p_in_Oth=(tau_in_us_Oth^(-theta)*Ttil_us_Oth*Trade_shares_Oth_in(1,1)+Ttil_in_Oth*Trade_shares_Oth_in(1,2)+tau_in_eu_Oth^(-theta)*Ttil_eu_Oth*Trade_shares_Oth_in(1,3)+...
    tau_in_ca_Oth^(-theta)*Ttil_ca_Oth*Trade_shares_Oth_in(1,4)+tau_in_ch_Oth^(-theta)*Ttil_ch_Oth*Trade_shares_Oth_in(1,5)+tau_in_ot_Oth^(-theta)*Ttil_ot_Oth*Trade_shares_Oth_in(1,6))^(-1/theta);
p_in_Fin=(tau_in_us_Fin^(-theta)*Ttil_us_Fin*Trade_shares_Fin_in(1,1)+Ttil_in_Fin*Trade_shares_Fin_in(1,2)+tau_in_eu_Fin^(-theta)*Ttil_eu_Fin*Trade_shares_Fin_in(1,3)+...
    tau_in_ca_Fin^(-theta)*Ttil_ca_Fin*Trade_shares_Fin_in(1,4)+tau_in_ch_Fin^(-theta)*Ttil_ch_Fin*Trade_shares_Fin_in(1,5)+tau_in_ot_Fin^(-theta)*Ttil_ot_Fin*Trade_shares_Fin_in(1,6))^(-1/theta);

p_eu_IT=(tau_eu_us_IT^(-theta)*Ttil_us_IT*Trade_shares_IT_eu(1,1)+tau_eu_in_IT^(-theta)*Ttil_in_IT*Trade_shares_IT_eu(1,2)+Ttil_eu_IT*Trade_shares_IT_eu(1,3)+...
    tau_eu_ca_IT^(-theta)*Ttil_ca_IT*Trade_shares_IT_eu(1,4)+tau_eu_ch_IT^(-theta)*Ttil_ch_IT*Trade_shares_IT_eu(1,5)+tau_eu_ot_IT^(-theta)*Ttil_ot_IT*Trade_shares_IT_eu(1,6))^(-1/theta);
p_eu_Man=(tau_eu_us_Man^(-theta)*Ttil_us_Man*Trade_shares_Man_eu(1,1)+tau_eu_in_Man^(-theta)*Ttil_in_Man*Trade_shares_Man_eu(1,2)+Ttil_eu_Man*Trade_shares_Man_eu(1,3)+...
    tau_eu_ca_Man^(-theta)*Ttil_ca_Man*Trade_shares_Man_eu(1,4)+tau_eu_ch_Man^(-theta)*Ttil_ch_Man*Trade_shares_Man_eu(1,5)+tau_eu_ot_Man^(-theta)*Ttil_ot_Man*Trade_shares_Man_eu(1,6))^(-1/theta);
p_eu_Oth=(tau_eu_us_Oth^(-theta)*Ttil_us_Oth*Trade_shares_Oth_eu(1,1)+tau_eu_in_Oth^(-theta)*Ttil_in_Oth*Trade_shares_Oth_eu(1,2)+Ttil_eu_Oth*Trade_shares_Oth_eu(1,3)+...
    tau_eu_ca_Oth^(-theta)*Ttil_ca_Oth*Trade_shares_Oth_eu(1,4)+tau_eu_ch_Oth^(-theta)*Ttil_ch_Oth*Trade_shares_Oth_eu(1,5)+tau_eu_ot_Oth^(-theta)*Ttil_ot_Oth*Trade_shares_Oth_eu(1,6))^(-1/theta);
p_eu_Fin=(tau_eu_us_Fin^(-theta)*Ttil_us_Fin*Trade_shares_Fin_eu(1,1)+tau_eu_in_Fin^(-theta)*Ttil_in_Fin*Trade_shares_Fin_eu(1,2)+Ttil_eu_Fin*Trade_shares_Fin_eu(1,3)+...
    tau_eu_ca_Fin^(-theta)*Ttil_ca_Fin*Trade_shares_Fin_eu(1,4)+tau_eu_ch_Fin^(-theta)*Ttil_ch_Fin*Trade_shares_Fin_eu(1,5)+tau_eu_ot_Fin^(-theta)*Ttil_ot_Fin*Trade_shares_Fin_eu(1,6))^(-1/theta);

p_ca_IT=(tau_ca_us_IT^(-theta)*Ttil_us_IT*Trade_shares_IT_ca(1,1)+tau_ca_in_IT^(-theta)*Ttil_in_IT*Trade_shares_IT_ca(1,2)+tau_ca_eu_IT^(-theta)*Ttil_eu_IT*Trade_shares_IT_ca(1,3)+...
    Ttil_ca_IT*Trade_shares_IT_ca(1,4)+tau_ca_ch_IT^(-theta)*Ttil_ch_IT*Trade_shares_IT_ca(1,5)+tau_ca_ot_IT^(-theta)*Ttil_ot_IT*Trade_shares_IT_ca(1,6))^(-1/theta);
p_ca_Man=(tau_ca_us_Man^(-theta)*Ttil_us_Man*Trade_shares_Man_ca(1,1)+tau_ca_in_Man^(-theta)*Ttil_in_Man*Trade_shares_Man_ca(1,2)+tau_ca_eu_Man^(-theta)*Ttil_eu_Man*Trade_shares_Man_ca(1,3)+...
    Ttil_ca_Man*Trade_shares_Man_ca(1,4)+tau_ca_ch_Man^(-theta)*Ttil_ch_Man*Trade_shares_Man_ca(1,5)+tau_ca_ot_Man^(-theta)*Ttil_ot_Man*Trade_shares_Man_ca(1,6))^(-1/theta);
p_ca_Oth=(tau_ca_us_Oth^(-theta)*Ttil_us_Oth*Trade_shares_Oth_ca(1,1)+tau_ca_in_Oth^(-theta)*Ttil_in_Oth*Trade_shares_Oth_ca(1,2)+tau_ca_eu_Oth^(-theta)*Ttil_eu_Oth*Trade_shares_Oth_ca(1,3)+...
    Ttil_ca_Oth*Trade_shares_Oth_ca(1,4)+tau_ca_ch_Oth^(-theta)*Ttil_ch_Oth*Trade_shares_Oth_ca(1,5)+tau_ca_ot_Oth^(-theta)*Ttil_ot_Oth*Trade_shares_Oth_ca(1,6))^(-1/theta);
p_ca_Fin=(tau_ca_us_Fin^(-theta)*Ttil_us_Fin*Trade_shares_Fin_ca(1,1)+tau_ca_in_Fin^(-theta)*Ttil_in_Fin*Trade_shares_Fin_ca(1,2)+tau_ca_eu_Fin^(-theta)*Ttil_eu_Fin*Trade_shares_Fin_ca(1,3)+...
    Ttil_ca_Fin*Trade_shares_Fin_ca(1,4)+tau_ca_ch_Fin^(-theta)*Ttil_ch_Fin*Trade_shares_Fin_ca(1,5)+tau_ca_ot_Fin^(-theta)*Ttil_ot_Fin*Trade_shares_Fin_ca(1,6))^(-1/theta);

p_ch_IT=(tau_ch_us_IT^(-theta)*Ttil_us_IT*Trade_shares_IT_ch(1,1)+tau_ch_in_IT^(-theta)*Ttil_in_IT*Trade_shares_IT_ch(1,2)+tau_ch_eu_IT^(-theta)*Ttil_eu_IT*Trade_shares_IT_ch(1,3)+...
    tau_ch_ca_IT^(-theta)*Ttil_ca_IT*Trade_shares_IT_ch(1,4)+Ttil_ch_IT*Trade_shares_IT_ch(1,5)+tau_ch_ot_IT^(-theta)*Ttil_ot_IT*Trade_shares_IT_ch(1,6))^(-1/theta);
p_ch_Man=(tau_ch_us_Man^(-theta)*Ttil_us_Man*Trade_shares_Man_ch(1,1)+tau_ch_in_Man^(-theta)*Ttil_in_Man*Trade_shares_Man_ch(1,2)+tau_ch_eu_Man^(-theta)*Ttil_eu_Man*Trade_shares_Man_ch(1,3)+...
    tau_ch_ca_Man^(-theta)*Ttil_ca_Man*Trade_shares_Man_ch(1,4)+Ttil_ch_Man*Trade_shares_Man_ch(1,5)+tau_ch_ot_Man^(-theta)*Ttil_ot_Man*Trade_shares_Man_ch(1,6))^(-1/theta);
p_ch_Oth=(tau_ch_us_Oth^(-theta)*Ttil_us_Oth*Trade_shares_Oth_ch(1,1)+tau_ch_in_Oth^(-theta)*Ttil_in_Oth*Trade_shares_Oth_ch(1,2)+tau_ch_eu_Oth^(-theta)*Ttil_eu_Oth*Trade_shares_Oth_ch(1,3)+...
    tau_ch_ca_Oth^(-theta)*Ttil_ca_Oth*Trade_shares_Oth_ch(1,4)+Ttil_ch_Oth*Trade_shares_Oth_ch(1,5)+tau_ch_ot_Man^(-theta)*Ttil_ot_Oth*Trade_shares_Oth_ch(1,6))^(-1/theta);
p_ch_Fin=(tau_ch_us_Fin^(-theta)*Ttil_us_Fin*Trade_shares_Fin_ch(1,1)+tau_ch_in_Fin^(-theta)*Ttil_in_Fin*Trade_shares_Fin_ch(1,2)+tau_ch_eu_Fin^(-theta)*Ttil_eu_Fin*Trade_shares_Fin_ch(1,3)+...
    tau_ch_ca_Fin^(-theta)*Ttil_ca_Fin*Trade_shares_Fin_ch(1,4)+Ttil_ch_Fin*Trade_shares_Fin_ch(1,5)+tau_ch_ot_Fin^(-theta)*Ttil_ot_Fin*Trade_shares_Fin_ch(1,6))^(-1/theta);


p_ot_IT=(tau_ot_us_IT^(-theta)*Ttil_us_IT*Trade_shares_IT_ot(1,1)+tau_ot_in_IT^(-theta)*Ttil_in_IT*Trade_shares_IT_ot(1,2)+tau_ot_eu_IT^(-theta)*Ttil_eu_IT*Trade_shares_IT_ot(1,3)+...
    tau_ot_ca_IT^(-theta)*Ttil_ca_IT*Trade_shares_IT_ot(1,4)+tau_ot_ch_IT^(-theta)*Ttil_ch_IT*Trade_shares_IT_ot(1,5)+Ttil_ot_IT*Trade_shares_IT_ot(1,6))^(-1/theta);
p_ot_Man=(tau_ot_us_Man^(-theta)*Ttil_us_Man*Trade_shares_Man_ot(1,1)+tau_ot_in_Man^(-theta)*Ttil_in_Man*Trade_shares_Man_ot(1,2)+tau_ot_eu_Man^(-theta)*Ttil_eu_Man*Trade_shares_Man_ot(1,3)+...
    tau_ot_ca_Man^(-theta)*Ttil_ca_Man*Trade_shares_Man_ot(1,4)+tau_ot_ch_Man^(-theta)*Ttil_ch_Man*Trade_shares_Man_ot(1,5)+Ttil_ot_Man*Trade_shares_Man_ot(1,6))^(-1/theta);
p_ot_Oth=(tau_ot_us_Oth^(-theta)*Ttil_us_Oth*Trade_shares_Oth_ot(1,1)+tau_ot_in_Oth^(-theta)*Ttil_in_Oth*Trade_shares_Oth_ot(1,2)+tau_ot_eu_Oth^(-theta)*Ttil_eu_Oth*Trade_shares_Oth_ot(1,3)+...
    tau_ot_ca_Oth^(-theta)*Ttil_ca_Oth*Trade_shares_Oth_ot(1,4)+tau_ot_ch_Oth^(-theta)*Ttil_ch_Oth*Trade_shares_Oth_ot(1,5)+Ttil_ot_Oth*Trade_shares_Oth_ot(1,6))^(-1/theta);
p_ot_Fin=(tau_ot_us_Fin^(-theta)*Ttil_us_Fin*Trade_shares_Fin_ot(1,1)+tau_ot_in_Fin^(-theta)*Ttil_in_Fin*Trade_shares_Fin_ot(1,2)+tau_ot_eu_Fin^(-theta)*Ttil_eu_Fin*Trade_shares_Fin_ot(1,3)+...
    tau_ot_ca_Fin^(-theta)*Ttil_ca_Fin*Trade_shares_Fin_ot(1,4)+tau_ot_ch_Fin^(-theta)*Ttil_ch_Fin*Trade_shares_Fin_ot(1,5)+Ttil_ot_Fin*Trade_shares_Fin_ot(1,6))^(-1/theta);


%Trade shares

%US
trade_us_us_IT=Ttil_us_IT/p_us_IT^(-theta);
trade_us_in_IT=tau_us_in_IT^(-theta)*Ttil_in_IT/p_us_IT^(-theta);
trade_us_eu_IT=tau_us_eu_IT^(-theta)*Ttil_eu_IT/p_us_IT^(-theta);
trade_us_ca_IT=tau_us_ca_IT^(-theta)*Ttil_ca_IT/p_us_IT^(-theta);
trade_us_ch_IT=tau_us_ch_IT^(-theta)*Ttil_ch_IT/p_us_IT^(-theta);
trade_us_ot_IT=tau_us_ot_IT^(-theta)*Ttil_ot_IT/p_us_IT^(-theta);


trade_us_us_Man=Ttil_us_Man/p_us_Man^(-theta);
trade_us_in_Man=tau_us_in_Man^(-theta)*Ttil_in_Man/p_us_Man^(-theta);
trade_us_eu_Man=tau_us_eu_Man^(-theta)*Ttil_eu_Man/p_us_Man^(-theta);
trade_us_ca_Man=tau_us_ca_Man^(-theta)*Ttil_ca_Man/p_us_Man^(-theta);
trade_us_ch_Man=tau_us_ch_Man^(-theta)*Ttil_ch_Man/p_us_Man^(-theta);
trade_us_ot_Man=tau_us_ot_Man^(-theta)*Ttil_ot_Man/p_us_Man^(-theta);

trade_us_us_Oth=Ttil_us_Oth/p_us_Oth^(-theta);
trade_us_in_Oth=tau_us_in_Oth^(-theta)*Ttil_in_Oth/p_us_Oth^(-theta);
trade_us_eu_Oth=tau_us_eu_Oth^(-theta)*Ttil_eu_Oth/p_us_Oth^(-theta);
trade_us_ca_Oth=tau_us_ca_Oth^(-theta)*Ttil_ca_Oth/p_us_Oth^(-theta);
trade_us_ch_Oth=tau_us_ch_Oth^(-theta)*Ttil_ch_Oth/p_us_Oth^(-theta);
trade_us_ot_Oth=tau_us_ot_Oth^(-theta)*Ttil_ot_Oth/p_us_Oth^(-theta);

trade_us_us_Fin=Ttil_us_Fin/p_us_Fin^(-theta);
trade_us_in_Fin=tau_us_in_Fin^(-theta)*Ttil_in_Fin/p_us_Fin^(-theta);
trade_us_eu_Fin=tau_us_eu_Fin^(-theta)*Ttil_eu_Fin/p_us_Fin^(-theta);
trade_us_ca_Fin=tau_us_ca_Fin^(-theta)*Ttil_ca_Fin/p_us_Fin^(-theta);
trade_us_ch_Fin=tau_us_ch_Fin^(-theta)*Ttil_ch_Fin/p_us_Fin^(-theta);
trade_us_ot_Fin=tau_us_ot_Fin^(-theta)*Ttil_ot_Fin/p_us_Fin^(-theta);



%India

trade_in_us_IT=tau_in_us_IT^(-theta)*Ttil_us_IT/p_in_IT^(-theta);
trade_in_in_IT=Ttil_in_IT/p_in_IT^(-theta);
trade_in_eu_IT=tau_in_eu_IT^(-theta)*Ttil_eu_IT/p_in_IT^(-theta);
trade_in_ca_IT=tau_in_ca_IT^(-theta)*Ttil_ca_IT/p_in_IT^(-theta);
trade_in_ch_IT=tau_in_ch_IT^(-theta)*Ttil_ch_IT/p_in_IT^(-theta);
trade_in_ot_IT=tau_in_ot_IT^(-theta)*Ttil_ot_IT/p_in_IT^(-theta);


trade_in_us_Man=tau_in_us_Man^(-theta)*Ttil_us_Man/p_in_Man^(-theta);
trade_in_in_Man=Ttil_in_Man/p_in_Man^(-theta);
trade_in_eu_Man=tau_in_eu_Man^(-theta)*Ttil_eu_Man/p_in_Man^(-theta);
trade_in_ca_Man=tau_in_ca_Man^(-theta)*Ttil_ca_Man/p_in_Man^(-theta);
trade_in_ch_Man=tau_in_ch_Man^(-theta)*Ttil_ch_Man/p_in_Man^(-theta);
trade_in_ot_Man=tau_in_ot_Man^(-theta)*Ttil_ot_Man/p_in_Man^(-theta);

trade_in_us_Oth=tau_in_us_Oth^(-theta)*Ttil_us_Oth/p_in_Oth^(-theta);
trade_in_in_Oth=Ttil_in_Oth/p_in_Oth^(-theta);
trade_in_eu_Oth=tau_in_eu_Oth^(-theta)*Ttil_eu_Oth/p_in_Oth^(-theta);
trade_in_ca_Oth=tau_in_ca_Oth^(-theta)*Ttil_ca_Oth/p_in_Oth^(-theta);
trade_in_ch_Oth=tau_in_ch_Oth^(-theta)*Ttil_ch_Oth/p_in_Oth^(-theta);
trade_in_ot_Oth=tau_in_ot_Oth^(-theta)*Ttil_ot_Oth/p_in_Oth^(-theta);

trade_in_us_Fin=tau_in_us_Fin^(-theta)*Ttil_us_Fin/p_in_Fin^(-theta);
trade_in_in_Fin=Ttil_in_Fin/p_in_Fin^(-theta);
trade_in_eu_Fin=tau_in_eu_Fin^(-theta)*Ttil_eu_Fin/p_in_Fin^(-theta);
trade_in_ca_Fin=tau_in_ca_Fin^(-theta)*Ttil_ca_Fin/p_in_Fin^(-theta);
trade_in_ch_Fin=tau_in_ch_Fin^(-theta)*Ttil_ch_Fin/p_in_Fin^(-theta);
trade_in_ot_Fin=tau_in_ot_Fin^(-theta)*Ttil_ot_Fin/p_in_Fin^(-theta);

%Europe


trade_eu_us_IT=tau_eu_us_IT^(-theta)*Ttil_us_IT/p_eu_IT^(-theta);
trade_eu_in_IT=tau_eu_in_IT^(-theta)*Ttil_in_IT/p_eu_IT^(-theta);
trade_eu_eu_IT=Ttil_eu_IT/p_eu_IT^(-theta);
trade_eu_ca_IT=tau_eu_ca_IT^(-theta)*Ttil_ca_IT/p_eu_IT^(-theta);
trade_eu_ch_IT=tau_eu_ch_IT^(-theta)*Ttil_ch_IT/p_eu_IT^(-theta);
trade_eu_ot_IT=tau_eu_ot_IT^(-theta)*Ttil_ot_IT/p_eu_IT^(-theta);


trade_eu_us_Man=tau_eu_us_Man^(-theta)*Ttil_us_Man/p_eu_Man^(-theta);
trade_eu_in_Man=tau_eu_in_Man^(-theta)*Ttil_in_Man/p_eu_Man^(-theta);
trade_eu_eu_Man=Ttil_eu_Man/p_eu_Man^(-theta);
trade_eu_ca_Man=tau_eu_ca_Man^(-theta)*Ttil_ca_Man/p_eu_Man^(-theta);
trade_eu_ch_Man=tau_eu_ch_Man^(-theta)*Ttil_ch_Man/p_eu_Man^(-theta);
trade_eu_ot_Man=tau_eu_ot_Man^(-theta)*Ttil_ot_Man/p_eu_Man^(-theta);

trade_eu_us_Oth=tau_eu_us_Oth^(-theta)*Ttil_us_Oth/p_eu_Oth^(-theta);
trade_eu_in_Oth=tau_eu_in_Oth^(-theta)*Ttil_in_Oth/p_eu_Oth^(-theta);
trade_eu_eu_Oth=Ttil_eu_Oth/p_eu_Oth^(-theta);
trade_eu_ca_Oth=tau_eu_ca_Oth^(-theta)*Ttil_ca_Oth/p_eu_Oth^(-theta);
trade_eu_ch_Oth=tau_eu_ch_Oth^(-theta)*Ttil_ch_Oth/p_eu_Oth^(-theta);
trade_eu_ot_Oth=tau_eu_ot_Oth^(-theta)*Ttil_ot_Oth/p_eu_Oth^(-theta);

trade_eu_us_Fin=tau_eu_us_Fin^(-theta)*Ttil_us_Fin/p_eu_Fin^(-theta);
trade_eu_in_Fin=tau_eu_in_Fin^(-theta)*Ttil_in_Fin/p_eu_Fin^(-theta);
trade_eu_eu_Fin=Ttil_eu_Fin/p_eu_Fin^(-theta);
trade_eu_ca_Fin=tau_eu_ca_Fin^(-theta)*Ttil_ca_Fin/p_eu_Fin^(-theta);
trade_eu_ch_Fin=tau_eu_ch_Fin^(-theta)*Ttil_ch_Fin/p_eu_Fin^(-theta);
trade_eu_ot_Fin=tau_eu_ot_Fin^(-theta)*Ttil_ot_Fin/p_eu_Fin^(-theta);

%Canada

trade_ca_us_IT=tau_ca_us_IT^(-theta)*Ttil_us_IT/p_ca_IT^(-theta);
trade_ca_in_IT=tau_ca_in_IT^(-theta)*Ttil_in_IT/p_ca_IT^(-theta);
trade_ca_eu_IT=tau_ca_eu_IT^(-theta)*Ttil_eu_IT/p_ca_IT^(-theta);
trade_ca_ca_IT=Ttil_ca_IT/p_ca_IT^(-theta);
trade_ca_ch_IT=tau_ca_ch_IT^(-theta)*Ttil_ch_IT/p_ca_IT^(-theta);
trade_ca_ot_IT=tau_ca_ot_IT^(-theta)*Ttil_ot_IT/p_ca_IT^(-theta);


trade_ca_us_Man=tau_ca_us_Man^(-theta)*Ttil_us_Man/p_ca_Man^(-theta);
trade_ca_in_Man=tau_ca_in_Man^(-theta)*Ttil_in_Man/p_ca_Man^(-theta);
trade_ca_eu_Man=tau_ca_eu_Man^(-theta)*Ttil_eu_Man/p_ca_Man^(-theta);
trade_ca_ca_Man=Ttil_ca_Man/p_ca_Man^(-theta);
trade_ca_ch_Man=tau_ca_ch_Man^(-theta)*Ttil_ch_Man/p_ca_Man^(-theta);
trade_ca_ot_Man=tau_ca_ot_Man^(-theta)*Ttil_ot_Man/p_ca_Man^(-theta);

trade_ca_us_Oth=tau_ca_us_Oth^(-theta)*Ttil_us_Oth/p_ca_Oth^(-theta);
trade_ca_in_Oth=tau_ca_in_Oth^(-theta)*Ttil_in_Oth/p_ca_Oth^(-theta);
trade_ca_eu_Oth=tau_ca_eu_Oth^(-theta)*Ttil_eu_Oth/p_ca_Oth^(-theta);
trade_ca_ca_Oth=Ttil_ca_Oth/p_ca_Oth^(-theta);
trade_ca_ch_Oth=tau_ca_ch_Oth^(-theta)*Ttil_ch_Oth/p_ca_Oth^(-theta);
trade_ca_ot_Oth=tau_ca_ot_Oth^(-theta)*Ttil_ot_Oth/p_ca_Oth^(-theta);

trade_ca_us_Fin=tau_ca_us_Fin^(-theta)*Ttil_us_Fin/p_ca_Fin^(-theta);
trade_ca_in_Fin=tau_ca_in_Fin^(-theta)*Ttil_in_Fin/p_ca_Fin^(-theta);
trade_ca_eu_Fin=tau_ca_eu_Fin^(-theta)*Ttil_eu_Fin/p_ca_Fin^(-theta);
trade_ca_ca_Fin=Ttil_ca_Fin/p_ca_Fin^(-theta);
trade_ca_ch_Fin=tau_ca_ch_Fin^(-theta)*Ttil_ch_Fin/p_ca_Fin^(-theta);
trade_ca_ot_Fin=tau_ca_ot_Fin^(-theta)*Ttil_ot_Fin/p_ca_Fin^(-theta);

%China

trade_ch_us_IT=tau_ch_us_IT^(-theta)*Ttil_us_IT/p_ch_IT^(-theta);
trade_ch_in_IT=tau_ch_in_IT^(-theta)*Ttil_in_IT/p_ch_IT^(-theta);
trade_ch_eu_IT=tau_ch_eu_IT^(-theta)*Ttil_eu_IT/p_ch_IT^(-theta);
trade_ch_ca_IT=tau_ch_ca_IT^(-theta)*Ttil_ca_IT/p_ch_IT^(-theta);
trade_ch_ch_IT=Ttil_ch_IT/p_ch_IT^(-theta);
trade_ch_ot_IT=tau_ch_ot_IT^(-theta)*Ttil_ot_IT/p_ch_IT^(-theta);


trade_ch_us_Man=tau_ch_us_Man^(-theta)*Ttil_us_Man/p_ch_Man^(-theta);
trade_ch_in_Man=tau_ch_in_Man^(-theta)*Ttil_in_Man/p_ch_Man^(-theta);
trade_ch_eu_Man=tau_ch_eu_Man^(-theta)*Ttil_eu_Man/p_ch_Man^(-theta);
trade_ch_ca_Man=tau_ch_ca_Man^(-theta)*Ttil_ca_Man/p_ch_Man^(-theta);
trade_ch_ch_Man=Ttil_ch_Man/p_ch_Man^(-theta);
trade_ch_ot_Man=tau_ch_ot_Man^(-theta)*Ttil_ot_Man/p_ch_Man^(-theta);

trade_ch_us_Oth=tau_ch_us_Oth^(-theta)*Ttil_us_Oth/p_ch_Oth^(-theta);
trade_ch_in_Oth=tau_ch_in_Oth^(-theta)*Ttil_in_Oth/p_ch_Oth^(-theta);
trade_ch_eu_Oth=tau_ch_eu_Oth^(-theta)*Ttil_eu_Oth/p_ch_Oth^(-theta);
trade_ch_ca_Oth=tau_ch_ca_Oth^(-theta)*Ttil_ca_Oth/p_ch_Oth^(-theta);
trade_ch_ch_Oth=Ttil_ch_Oth/p_ch_Oth^(-theta);
trade_ch_ot_Oth=tau_ch_ot_Man^(-theta)*Ttil_ot_Oth/p_ch_Oth^(-theta);

trade_ch_us_Fin=tau_ch_us_Fin^(-theta)*Ttil_us_Fin/p_ch_Fin^(-theta);
trade_ch_in_Fin=tau_ch_in_Fin^(-theta)*Ttil_in_Fin/p_ch_Fin^(-theta);
trade_ch_eu_Fin=tau_ch_eu_Fin^(-theta)*Ttil_eu_Fin/p_ch_Fin^(-theta);
trade_ch_ca_Fin=tau_ch_ca_Fin^(-theta)*Ttil_ca_Fin/p_ch_Fin^(-theta);
trade_ch_ch_Fin=Ttil_ch_Fin/p_ch_Fin^(-theta);
trade_ch_ot_Fin=tau_ch_ot_Fin^(-theta)*Ttil_ot_Fin/p_ch_Fin^(-theta);

%Other

trade_ot_us_IT=tau_ot_us_IT^(-theta)*Ttil_us_IT/p_ot_IT^(-theta);
trade_ot_in_IT=tau_ot_in_IT^(-theta)*Ttil_in_IT/p_ot_IT^(-theta);
trade_ot_eu_IT=tau_ot_eu_IT^(-theta)*Ttil_eu_IT/p_ot_IT^(-theta);
trade_ot_ca_IT=tau_ot_ca_IT^(-theta)*Ttil_ca_IT/p_ot_IT^(-theta);
trade_ot_ch_IT=tau_ot_ch_IT^(-theta)*Ttil_ch_IT/p_ot_IT^(-theta);
trade_ot_ot_IT=Ttil_ot_IT/p_ot_IT^(-theta);


trade_ot_us_Man=tau_ot_us_Man^(-theta)*Ttil_us_Man/p_ot_Man^(-theta);
trade_ot_in_Man=tau_ot_in_Man^(-theta)*Ttil_in_Man/p_ot_Man^(-theta);
trade_ot_eu_Man=tau_ot_eu_Man^(-theta)*Ttil_eu_Man/p_ot_Man^(-theta);
trade_ot_ca_Man=tau_ot_ca_Man^(-theta)*Ttil_ca_Man/p_ot_Man^(-theta);
trade_ot_ch_Man=tau_ot_ch_Man^(-theta)*Ttil_ch_Man/p_ot_Man^(-theta);
trade_ot_ot_Man=Ttil_ot_Man/p_ot_Man^(-theta);

trade_ot_us_Oth=tau_ot_us_Oth^(-theta)*Ttil_us_Oth/p_ot_Oth^(-theta);
trade_ot_in_Oth=tau_ot_in_Oth^(-theta)*Ttil_in_Oth/p_ot_Oth^(-theta);
trade_ot_eu_Oth=tau_ot_eu_Oth^(-theta)*Ttil_eu_Oth/p_ot_Oth^(-theta);
trade_ot_ca_Oth=tau_ot_ca_Oth^(-theta)*Ttil_ca_Oth/p_ot_Oth^(-theta);
trade_ot_ch_Oth=tau_ot_ch_Oth^(-theta)*Ttil_ch_Oth/p_ot_Oth^(-theta);
trade_ot_ot_Oth=Ttil_ot_Oth/p_ot_Oth^(-theta);

trade_ot_us_Fin=tau_ot_us_Fin^(-theta)*Ttil_us_Fin/p_ot_Fin^(-theta);
trade_ot_in_Fin=tau_ot_in_Fin^(-theta)*Ttil_in_Fin/p_ot_Fin^(-theta);
trade_ot_eu_Fin=tau_ot_eu_Fin^(-theta)*Ttil_eu_Fin/p_ot_Fin^(-theta);
trade_ot_ca_Fin=tau_ot_ca_Fin^(-theta)*Ttil_ca_Fin/p_ot_Fin^(-theta);
trade_ot_ch_Fin=tau_ot_ch_Fin^(-theta)*Ttil_ch_Fin/p_ot_Fin^(-theta);
trade_ot_ot_Fin=Ttil_ot_Fin/p_ot_Fin^(-theta);


%MNE shares

mne_us_us_IT=T_us_IT*(cost_us_IT_us)^(-theta)/Ttil_us_IT;
mne_us_in_IT=T_in_IT*(cost_us_IT_in*delta_us_in_IT)^(-theta)/Ttil_us_IT;
mne_us_eu_IT=T_eu_IT*(cost_us_IT_eu*delta_us_eu_IT)^(-theta)/Ttil_us_IT;
mne_us_ca_IT=T_ca_IT*(cost_us_IT_ca*delta_us_ca_IT)^(-theta)/Ttil_us_IT;
mne_us_ch_IT=T_ch_IT*(cost_us_IT_ch*delta_us_ch_IT)^(-theta)/Ttil_us_IT;


mne_us_us_Man=T_us_Man*(cost_us_Man_us)^(-theta)/Ttil_us_Man;
mne_us_in_Man=T_in_Man*(cost_us_Man_in*delta_us_in_Man)^(-theta)/Ttil_us_Man;
mne_us_eu_Man=T_eu_Man*(cost_us_Man_eu*delta_us_eu_Man)^(-theta)/Ttil_us_Man;
mne_us_ca_Man=T_ca_Man*(cost_us_Man_ca*delta_us_ca_Man)^(-theta)/Ttil_us_Man;
mne_us_ch_Man=T_ch_Man*(cost_us_Man_ch*delta_us_ch_Man)^(-theta)/Ttil_us_Man;

mne_us_us_Fin=T_us_Fin*(cost_us_Fin_us)^(-theta)/Ttil_us_Fin;
mne_us_in_Fin=T_in_Fin*(cost_us_Fin_in*delta_us_in_Fin)^(-theta)/Ttil_us_Fin;
mne_us_eu_Fin=T_eu_Fin*(cost_us_Fin_eu*delta_us_eu_Fin)^(-theta)/Ttil_us_Fin;
mne_us_ca_Fin=T_ca_Fin*(cost_us_Fin_ca*delta_us_ca_Fin)^(-theta)/Ttil_us_Fin;
mne_us_ch_Fin=T_ch_Fin*(cost_us_Fin_ch*delta_us_ch_Fin)^(-theta)/Ttil_us_Fin;


mne_in_us_IT=T_us_IT*(cost_in_IT_us*delta_in_us_IT)^(-theta)/Ttil_in_IT;
mne_in_in_IT=T_in_IT*(cost_in_IT_in)^(-theta)/Ttil_in_IT;
mne_in_eu_IT=T_eu_IT*(cost_in_IT_eu*delta_in_eu_IT)^(-theta)/Ttil_in_IT;
mne_in_ca_IT=T_ca_IT*(cost_in_IT_ca*delta_in_ca_IT)^(-theta)/Ttil_in_IT;
mne_in_ch_IT=T_ch_IT*(cost_in_IT_ch*delta_in_ch_IT)^(-theta)/Ttil_in_IT;


mne_in_us_Man=T_us_Man*(cost_in_Man_us*delta_in_us_Man)^(-theta)/Ttil_in_Man;
mne_in_in_Man=T_in_Man*(cost_in_Man_in)^(-theta)/Ttil_in_Man;
mne_in_eu_Man=T_eu_Man*(cost_in_Man_eu*delta_in_eu_Man)^(-theta)/Ttil_in_Man;
mne_in_ca_Man=T_ca_Man*(cost_in_Man_ca*delta_in_ca_Man)^(-theta)/Ttil_in_Man;
mne_in_ch_Man=T_ch_Man*(cost_in_Man_ch*delta_in_ch_Man)^(-theta)/Ttil_in_Man;

mne_in_us_Fin=T_us_Fin*(cost_in_Fin_us*delta_in_us_Fin)^(-theta)/Ttil_in_Fin;
mne_in_in_Fin=T_in_Fin*(cost_in_Fin_in)^(-theta)/Ttil_in_Fin;
mne_in_eu_Fin=T_eu_Fin*(cost_in_Fin_eu*delta_in_eu_Fin)^(-theta)/Ttil_in_Fin;
mne_in_ca_Fin=T_ca_Fin*(cost_in_Fin_ca*delta_in_ca_Fin)^(-theta)/Ttil_in_Fin;
mne_in_ch_Fin=T_ch_Fin*(cost_in_Fin_ch*delta_in_ch_Fin)^(-theta)/Ttil_in_Fin;


mne_eu_us_IT=T_us_IT*(cost_eu_IT_us*delta_eu_us_IT)^(-theta)/Ttil_eu_IT;
mne_eu_in_IT=T_in_IT*(cost_eu_IT_in*delta_eu_in_IT)^(-theta)/Ttil_eu_IT;
mne_eu_eu_IT=T_eu_IT*(cost_eu_IT_eu)^(-theta)/Ttil_eu_IT;
mne_eu_ca_IT=T_ca_IT*(cost_eu_IT_ca*delta_eu_ca_IT)^(-theta)/Ttil_eu_IT;
mne_eu_ch_IT=T_ch_IT*(cost_eu_IT_ch*delta_eu_ch_IT)^(-theta)/Ttil_eu_IT;


mne_eu_us_Man=T_us_Man*(cost_eu_Man_us*delta_eu_us_Man)^(-theta)/Ttil_eu_Man;
mne_eu_in_Man=T_in_Man*(cost_eu_Man_in*delta_eu_in_Man)^(-theta)/Ttil_eu_Man;
mne_eu_eu_Man=T_eu_Man*(cost_eu_Man_eu)^(-theta)/Ttil_eu_Man;
mne_eu_ca_Man=T_ca_Man*(cost_eu_Man_ca*delta_eu_ca_Man)^(-theta)/Ttil_eu_Man;
mne_eu_ch_Man=T_ch_Man*(cost_eu_Man_ch*delta_eu_ch_Man)^(-theta)/Ttil_eu_Man;

mne_eu_us_Fin=T_us_Fin*(cost_eu_Fin_us*delta_eu_us_Fin)^(-theta)/Ttil_eu_Fin;
mne_eu_in_Fin=T_in_Fin*(cost_eu_Fin_in*delta_eu_in_Fin)^(-theta)/Ttil_eu_Fin;
mne_eu_eu_Fin=T_eu_Fin*(cost_eu_Fin_eu)^(-theta)/Ttil_eu_Fin;
mne_eu_ca_Fin=T_ca_Fin*(cost_eu_Fin_ca*delta_eu_ca_Fin)^(-theta)/Ttil_eu_Fin;
mne_eu_ch_Fin=T_ch_Fin*(cost_eu_Fin_ch*delta_eu_ch_Fin)^(-theta)/Ttil_eu_Fin;



mne_ca_us_IT=T_us_IT*(cost_ca_IT_us*delta_ca_us_IT)^(-theta)/Ttil_ca_IT;
mne_ca_in_IT=T_in_IT*(cost_ca_IT_in*delta_ca_in_IT)^(-theta)/Ttil_ca_IT;
mne_ca_eu_IT=T_eu_IT*(cost_ca_IT_eu*delta_ca_eu_IT)^(-theta)/Ttil_ca_IT;
mne_ca_ca_IT=T_ca_IT*(cost_ca_IT_ca)^(-theta)/Ttil_ca_IT;
mne_ca_ch_IT=T_ch_IT*(cost_ca_IT_ch*delta_ca_ch_IT)^(-theta)/Ttil_ca_IT;


mne_ca_us_Man=T_us_Man*(cost_ca_Man_us*delta_ca_us_Man)^(-theta)/Ttil_ca_Man;
mne_ca_in_Man=T_in_Man*(cost_ca_Man_in*delta_ca_in_Man)^(-theta)/Ttil_ca_Man;
mne_ca_eu_Man=T_eu_Man*(cost_ca_Man_eu*delta_ca_eu_Man)^(-theta)/Ttil_ca_Man;
mne_ca_ca_Man=T_ca_Man*(cost_ca_Man_ca)^(-theta)/Ttil_ca_Man;
mne_ca_ch_Man=T_ch_Man*(cost_ca_Man_ch*delta_ca_ch_Man)^(-theta)/Ttil_ca_Man;

mne_ca_us_Fin=T_us_Fin*(cost_ca_Fin_us*delta_ca_us_Fin)^(-theta)/Ttil_ca_Fin;
mne_ca_in_Fin=T_in_Fin*(cost_ca_Fin_in*delta_ca_in_Fin)^(-theta)/Ttil_ca_Fin;
mne_ca_eu_Fin=T_eu_Fin*(cost_ca_Fin_eu*delta_ca_eu_Fin)^(-theta)/Ttil_ca_Fin;
mne_ca_ca_Fin=T_ca_Fin*(cost_ca_Fin_ca)^(-theta)/Ttil_ca_Fin;
mne_ca_ch_Fin=T_ch_Fin*(cost_ca_Fin_ch*delta_ca_ch_Fin)^(-theta)/Ttil_ca_Fin;


mne_ch_us_IT=T_us_IT*(cost_ch_IT_us*delta_ch_us_IT)^(-theta)/Ttil_ch_IT;
mne_ch_in_IT=T_in_IT*(cost_ch_IT_in*delta_ch_in_IT)^(-theta)/Ttil_ch_IT;
mne_ch_eu_IT=T_eu_IT*(cost_ch_IT_eu*delta_ch_eu_IT)^(-theta)/Ttil_ch_IT;
mne_ch_ca_IT=T_ca_IT*(cost_ch_IT_ca*delta_ch_ca_IT)^(-theta)/Ttil_ch_IT;
mne_ch_ch_IT=T_ch_IT*(cost_ch_IT_ch)^(-theta)/Ttil_ch_IT;


mne_ch_us_Man=T_us_Man*(cost_ch_Man_us*delta_ch_us_Man)^(-theta)/Ttil_ch_Man;
mne_ch_in_Man=T_in_Man*(cost_ch_Man_in*delta_ch_in_Man)^(-theta)/Ttil_ch_Man;
mne_ch_eu_Man=T_eu_Man*(cost_ch_Man_eu*delta_ch_eu_Man)^(-theta)/Ttil_ch_Man;
mne_ch_ca_Man=T_ca_Man*(cost_ch_Man_ca*delta_ch_ca_Man)^(-theta)/Ttil_ch_Man;
mne_ch_ch_Man=T_ch_Man*(cost_ch_Man_ch)^(-theta)/Ttil_ch_Man;

mne_ch_us_Fin=T_us_Fin*(cost_ch_Fin_us*delta_ch_us_Fin)^(-theta)/Ttil_ch_Fin;
mne_ch_in_Fin=T_in_Fin*(cost_ch_Fin_in*delta_ch_in_Fin)^(-theta)/Ttil_ch_Fin;
mne_ch_eu_Fin=T_eu_Fin*(cost_ch_Fin_eu*delta_ch_eu_Fin)^(-theta)/Ttil_ch_Fin;
mne_ch_ca_Fin=T_ca_Fin*(cost_ch_Fin_ca*delta_ch_ca_Fin)^(-theta)/Ttil_ch_Fin;
mne_ch_ch_Fin=T_ch_Fin*(cost_ch_Fin_ch)^(-theta)/Ttil_ch_Fin;

%Total expenditure

exp_us=L_us*w_us_L*(total_shares_us_us(1,3)+total_shares_us_us(1,6)+total_shares_us_us(1,9)+total_shares_us_in(1,4)+total_shares_us_in(1,8)+...
    total_shares_us_eu(1,4)+total_shares_us_eu(1,8)+total_shares_us_ca(1,4)+total_shares_us_ca(1,8)+total_shares_us_ch(1,4)+total_shares_us_ch(1,8))+...
w_us_IT_us_d*h_us_IT_us_d*total_shares_us_us(1,1)+...
w_us_IT_us_f*h_us_IT_us_f*total_shares_us_us(1,2)+...
w_us_Man_us_d*h_us_Man_us_d*total_shares_us_us(1,4)+...
w_us_Man_us_f*h_us_Man_us_f*total_shares_us_us(1,5)+...
w_us_Oth_us_d*h_us_Oth_us_d*total_shares_us_us(1,7)+...
w_us_Oth_us_f*h_us_Oth_us_f*total_shares_us_us(1,8)+...
w_us_IT_eu_d*h_us_IT_eu_d*total_shares_us_eu(1,1)+...
w_us_IT_eu_s*h_us_IT_eu_s*total_shares_us_eu(1,2)+...
w_us_IT_eu_f*h_us_IT_eu_f*total_shares_us_eu(1,3)+...
w_us_Man_eu_d*h_us_Man_eu_d*total_shares_us_eu(1,5)+...
w_us_Man_eu_s*h_us_Man_eu_s*total_shares_us_eu(1,6)+...
w_us_Man_eu_f*h_us_Man_eu_f*total_shares_us_eu(1,7)+...
w_us_IT_ca_d*h_us_IT_ca_d*total_shares_us_ca(1,1)+...
w_us_IT_ca_s*h_us_IT_ca_s*total_shares_us_ca(1,2)+...
w_us_IT_ca_f*h_us_IT_ca_f*total_shares_us_ca(1,3)+...
w_us_Man_ca_d*h_us_Man_ca_d*total_shares_us_ca(1,5)+...
w_us_Man_ca_s*h_us_Man_ca_s*total_shares_us_ca(1,6)+...
w_us_Man_ca_f*h_us_Man_ca_f*total_shares_us_ca(1,7)+...
w_us_IT_in_d*h_us_IT_in_d*total_shares_us_in(1,1)+...
w_us_IT_in_s*h_us_IT_in_s*total_shares_us_in(1,2)+...
w_us_IT_in_f*h_us_IT_in_f*total_shares_us_in(1,3)+...
w_us_Man_in_d*h_us_Man_in_d*total_shares_us_in(1,5)+...
w_us_Man_in_s*h_us_Man_in_s*total_shares_us_in(1,6)+...
w_us_Man_in_f*h_us_Man_in_f*total_shares_us_in(1,7)+...
w_us_IT_ch_d*h_us_IT_ch_d*total_shares_us_ch(1,1)+...
w_us_IT_ch_s*h_us_IT_ch_s*total_shares_us_ch(1,2)+...
w_us_IT_ch_f*h_us_IT_ch_f*total_shares_us_ch(1,3)+...
w_us_Man_ch_d*h_us_Man_ch_d*total_shares_us_ch(1,5)+...
w_us_Man_ch_s*h_us_Man_ch_s*total_shares_us_ch(1,6)+...
w_us_Man_ch_f*h_us_Man_ch_f*total_shares_us_ch(1,7)+...
L_us*w_us_L*(total_shares_us_us(1,12)+total_shares_us_in(1,12)+total_shares_us_eu(1,12)+total_shares_us_ca(1,12)+total_shares_us_ch(1,12))+...
w_us_Fin_us_d*h_us_Fin_us_d*total_shares_us_us(1,10)+...
w_us_Fin_us_f*h_us_Fin_us_f*total_shares_us_us(1,11)+...   
w_us_Fin_eu_d*h_us_Fin_eu_d*total_shares_us_eu(1,9)+...
w_us_Fin_eu_s*h_us_Fin_eu_s*total_shares_us_eu(1,10)+...
w_us_Fin_eu_f*h_us_Fin_eu_f*total_shares_us_eu(1,11)+...
w_us_Fin_ca_d*h_us_Fin_ca_d*total_shares_us_ca(1,9)+...
w_us_Fin_ca_s*h_us_Fin_ca_s*total_shares_us_ca(1,10)+...
w_us_Fin_ca_f*h_us_Fin_ca_f*total_shares_us_ca(1,11)+...
w_us_Fin_in_d*h_us_Fin_in_d*total_shares_us_in(1,9)+...
w_us_Fin_in_s*h_us_Fin_in_s*total_shares_us_in(1,10)+...
w_us_Fin_in_f*h_us_Fin_in_f*total_shares_us_in(1,11)+...
w_us_Fin_ch_d*h_us_Fin_ch_d*total_shares_us_ch(1,9)+...
w_us_Fin_ch_s*h_us_Fin_ch_s*total_shares_us_ch(1,10)+...
w_us_Fin_ch_f*h_us_Fin_ch_f*total_shares_us_ch(1,11);



exp_in=L_in*w_in_L*(total_shares_in_in(1,4)+total_shares_in_in(1,5)+total_shares_in_in(1,6)+total_shares_in_us(1,3)+total_shares_in_us(1,4)+...
    total_shares_in_eu(1,3)+total_shares_in_eu(1,4)+total_shares_in_ca(1,3)+total_shares_in_ca(1,4)+total_shares_in_ch(1,3)+total_shares_in_ch(1,4))+...
w_in_IT_us*h_in_IT_us*total_shares_in_us(1,1)+...
w_in_IT_in*h_in_IT_in*total_shares_in_in(1,1)+...
w_in_IT_eu*h_in_IT_eu*total_shares_in_eu(1,1)+...
w_in_IT_ca*h_in_IT_ca*total_shares_in_ca(1,1)+...
w_in_IT_ch*h_in_IT_ch*total_shares_in_ch(1,1)+...
w_in_Man_us*h_in_Man_us*total_shares_in_us(1,2)+...
w_in_Man_in*h_in_Man_in*total_shares_in_in(1,2)+...
w_in_Man_eu*h_in_Man_eu*total_shares_in_eu(1,2)+...
w_in_Man_ca*h_in_Man_ca*total_shares_in_ca(1,2)+...
w_in_Man_ch*h_in_Man_ch*total_shares_in_ch(1,2)+...
w_in_Oth_in*h_in_Oth_in*total_shares_in_in(1,3)+...
L_in*w_in_L*(total_shares_in_in(1,8)+total_shares_in_us(1,6)+total_shares_in_eu(1,6)+total_shares_in_ca(1,6)+total_shares_in_ch(1,6))+...
w_in_Fin_us*h_in_Fin_us*total_shares_in_us(1,5)+...
w_in_Fin_in*h_in_Fin_in*total_shares_in_in(1,7)+...
w_in_Fin_eu*h_in_Fin_eu*total_shares_in_eu(1,5)+...
w_in_Fin_ca*h_in_Fin_ca*total_shares_in_ca(1,5)+...
w_in_Fin_ch*h_in_Fin_ch*total_shares_in_ch(1,5);


exp_eu=L_eu*w_eu_L*(total_shares_eu_eu(1,3)+total_shares_eu_eu(1,6)+total_shares_eu_eu(1,9)+total_shares_eu_us(1,4)+total_shares_eu_us(1,8)+...
    total_shares_eu_in(1,4)+total_shares_eu_in(1,8)+total_shares_eu_ca(1,4)+total_shares_eu_ca(1,8)+total_shares_eu_ch(1,4)+total_shares_eu_ch(1,8))+...
w_eu_IT_eu_d*h_eu_IT_eu_d*total_shares_eu_eu(1,1)+...
w_eu_IT_eu_f*h_eu_IT_eu_f*total_shares_eu_eu(1,2)+...
w_eu_Man_eu_d*h_eu_Man_eu_d*total_shares_eu_eu(1,4)+...
w_eu_Man_eu_f*h_eu_Man_eu_f*total_shares_eu_eu(1,5)+...
w_eu_Oth_eu_d*h_eu_Oth_eu_d*total_shares_eu_eu(1,7)+...
w_eu_Oth_eu_f*h_eu_Oth_eu_f*total_shares_eu_eu(1,8)+...
w_eu_IT_us_d*h_eu_IT_us_d*total_shares_eu_us(1,1)+...
w_eu_IT_us_s*h_eu_IT_us_s*total_shares_eu_us(1,2)+...
w_eu_IT_us_f*h_eu_IT_us_f*total_shares_eu_us(1,3)+...
w_eu_Man_us_d*h_eu_Man_us_d*total_shares_eu_us(1,5)+...
w_eu_Man_us_s*h_eu_Man_us_s*total_shares_eu_us(1,6)+...
w_eu_Man_us_f*h_eu_Man_us_f*total_shares_eu_us(1,7)+...
w_eu_IT_ca_d*h_eu_IT_ca_d*total_shares_eu_ca(1,1)+...
w_eu_IT_ca_s*h_eu_IT_ca_s*total_shares_eu_ca(1,2)+...
w_eu_IT_ca_f*h_eu_IT_ca_f*total_shares_eu_ca(1,3)+...
w_eu_Man_ca_d*h_eu_Man_ca_d*total_shares_eu_ca(1,5)+...
w_eu_Man_ca_s*h_eu_Man_ca_s*total_shares_eu_ca(1,6)+...
w_eu_Man_ca_f*h_eu_Man_ca_f*total_shares_eu_ca(1,7)+...
w_eu_IT_in_d*h_eu_IT_in_d*total_shares_eu_in(1,1)+...
w_eu_IT_in_s*h_eu_IT_in_s*total_shares_eu_in(1,2)+...
w_eu_IT_in_f*h_eu_IT_in_f*total_shares_eu_in(1,3)+...
w_eu_Man_in_d*h_eu_Man_in_d*total_shares_eu_in(1,5)+...
w_eu_Man_in_s*h_eu_Man_in_s*total_shares_eu_in(1,6)+...
w_eu_Man_in_f*h_eu_Man_in_f*total_shares_eu_in(1,7)+...
w_eu_IT_ch_d*h_eu_IT_ch_d*total_shares_eu_ch(1,1)+...
w_eu_IT_ch_s*h_eu_IT_ch_s*total_shares_eu_ch(1,2)+...
w_eu_IT_ch_f*h_eu_IT_ch_f*total_shares_eu_ch(1,3)+...
w_eu_Man_ch_d*h_eu_Man_ch_d*total_shares_eu_ch(1,5)+...
w_eu_Man_ch_s*h_eu_Man_ch_s*total_shares_eu_ch(1,6)+...
w_eu_Man_ch_f*h_eu_Man_ch_f*total_shares_eu_ch(1,7)+...
L_eu*w_eu_L*(total_shares_eu_eu(1,12)+total_shares_eu_us(1,12)+total_shares_eu_in(1,12)+total_shares_eu_ca(1,12)+total_shares_eu_ch(1,12))+...
w_eu_Fin_eu_d*h_eu_Fin_eu_d*total_shares_eu_eu(1,10)+...
w_eu_Fin_eu_f*h_eu_Fin_eu_f*total_shares_eu_eu(1,11)+...
w_eu_Fin_us_d*h_eu_Fin_us_d*total_shares_eu_us(1,9)+...
w_eu_Fin_us_s*h_eu_Fin_us_s*total_shares_eu_us(1,10)+...
w_eu_Fin_us_f*h_eu_Fin_us_f*total_shares_eu_us(1,11)+...
w_eu_Fin_ca_d*h_eu_Fin_ca_d*total_shares_eu_ca(1,9)+...
w_eu_Fin_ca_s*h_eu_Fin_ca_s*total_shares_eu_ca(1,10)+...
w_eu_Fin_ca_f*h_eu_Fin_ca_f*total_shares_eu_ca(1,11)+...
w_eu_Fin_in_d*h_eu_Fin_in_d*total_shares_eu_in(1,9)+...
w_eu_Fin_in_s*h_eu_Fin_in_s*total_shares_eu_in(1,10)+...
w_eu_Fin_in_f*h_eu_Fin_in_f*total_shares_eu_in(1,11)+...
w_eu_Fin_ch_d*h_eu_Fin_ch_d*total_shares_eu_ch(1,9)+...
w_eu_Fin_ch_s*h_eu_Fin_ch_s*total_shares_eu_ch(1,10)+...
w_eu_Fin_ch_f*h_eu_Fin_ch_f*total_shares_eu_ch(1,11);



exp_ca=L_ca*w_ca_L*(total_shares_ca_ca(1,3)+total_shares_ca_ca(1,6)+total_shares_ca_ca(1,9)+total_shares_ca_us(1,4)+total_shares_ca_us(1,8)+...
    total_shares_ca_in(1,4)+total_shares_ca_in(1,8)+total_shares_ca_eu(1,4)+total_shares_ca_eu(1,8)+total_shares_ca_ch(1,4)+total_shares_ca_ch(1,8))+...
w_ca_IT_eu_d*h_ca_IT_ca_d*total_shares_ca_ca(1,1)+...
w_ca_IT_eu_f*h_ca_IT_ca_f*total_shares_ca_ca(1,2)+...
w_ca_Man_ca_d*h_ca_Man_ca_d*total_shares_ca_ca(1,4)+...
w_ca_Man_ca_f*h_ca_Man_ca_f*total_shares_ca_ca(1,5)+...
w_ca_Oth_ca_d*h_ca_Oth_ca_d*total_shares_ca_ca(1,7)+...
w_ca_Oth_ca_f*h_ca_Oth_ca_f*total_shares_ca_ca(1,8)+...
w_ca_IT_us_d*h_ca_IT_us_d*total_shares_ca_us(1,1)+...
w_ca_IT_us_s*h_ca_IT_us_s*total_shares_ca_us(1,2)+...
w_ca_IT_us_f*h_ca_IT_us_f*total_shares_ca_us(1,3)+...
w_ca_Man_us_d*h_ca_Man_us_d*total_shares_ca_us(1,5)+...
w_ca_Man_us_s*h_ca_Man_us_s*total_shares_ca_us(1,6)+...
w_ca_Man_us_f*h_ca_Man_us_f*total_shares_ca_us(1,7)+...
w_ca_IT_eu_d*h_ca_IT_eu_d*total_shares_ca_eu(1,1)+...
w_ca_IT_eu_s*h_ca_IT_eu_s*total_shares_ca_eu(1,2)+...
w_ca_IT_eu_f*h_ca_IT_eu_f*total_shares_ca_eu(1,3)+...
w_ca_Man_eu_d*h_ca_Man_eu_d*total_shares_ca_eu(1,5)+...
w_ca_Man_eu_s*h_ca_Man_eu_s*total_shares_ca_eu(1,6)+...
w_ca_Man_eu_f*h_ca_Man_eu_f*total_shares_ca_eu(1,7)+...
w_ca_IT_in_d*h_ca_IT_in_d*total_shares_ca_in(1,1)+...
w_ca_IT_in_s*h_ca_IT_in_s*total_shares_ca_in(1,2)+...
w_ca_IT_in_f*h_ca_IT_in_f*total_shares_ca_in(1,3)+...
w_ca_Man_in_d*h_ca_Man_in_d*total_shares_ca_in(1,5)+...
w_ca_Man_in_s*h_ca_Man_in_s*total_shares_ca_in(1,6)+...
w_ca_Man_in_f*h_ca_Man_in_f*total_shares_ca_in(1,7)+...
w_ca_IT_ch_d*h_ca_IT_ch_d*total_shares_ca_ch(1,1)+...
w_ca_IT_ch_s*h_ca_IT_ch_s*total_shares_ca_ch(1,2)+...
w_ca_IT_ch_f*h_ca_IT_ch_f*total_shares_ca_ch(1,3)+...
w_ca_Man_ch_d*h_ca_Man_ch_d*total_shares_ca_ch(1,5)+...
w_ca_Man_ch_s*h_ca_Man_ch_s*total_shares_ca_ch(1,6)+...
w_ca_Man_ch_f*h_ca_Man_ch_f*total_shares_ca_ch(1,7)+...
L_ca*w_ca_L*(total_shares_ca_ca(1,12)+total_shares_ca_us(1,12)+total_shares_ca_in(1,12)+total_shares_ca_eu(1,12)+total_shares_ca_ch(1,12))+...
w_ca_Fin_ca_d*h_ca_Fin_ca_d*total_shares_ca_ca(1,10)+...
w_ca_Fin_ca_f*h_ca_Fin_ca_f*total_shares_ca_ca(1,11)+...
w_ca_Fin_us_d*h_ca_Fin_us_d*total_shares_ca_us(1,9)+...
w_ca_Fin_us_s*h_ca_Fin_us_s*total_shares_ca_us(1,10)+...
w_ca_Fin_us_f*h_ca_Fin_us_f*total_shares_ca_us(1,11)+...
w_ca_Fin_eu_d*h_ca_Fin_eu_d*total_shares_ca_eu(1,9)+...
w_ca_Fin_eu_s*h_ca_Fin_eu_s*total_shares_ca_eu(1,10)+...
w_ca_Fin_eu_f*h_ca_Fin_eu_f*total_shares_ca_eu(1,11)+...
w_ca_Fin_in_d*h_ca_Fin_in_d*total_shares_ca_in(1,9)+...
w_ca_Fin_in_s*h_ca_Fin_in_s*total_shares_ca_in(1,10)+...
w_ca_Fin_in_f*h_ca_Fin_in_f*total_shares_ca_in(1,11)+...
w_ca_Fin_ch_d*h_ca_Fin_ch_d*total_shares_ca_ch(1,9)+...
w_ca_Fin_ch_s*h_ca_Fin_ch_s*total_shares_ca_ch(1,10)+...
w_ca_Fin_ch_f*h_ca_Fin_ch_f*total_shares_ca_ch(1,11);



exp_ch=L_ch*w_ch_L*(total_shares_ch_ch(1,4)+total_shares_ch_ch(1,5)+total_shares_ch_ch(1,6)+total_shares_ch_us(1,3)+total_shares_ch_us(1,4)+...
    total_shares_ch_in(1,3)+total_shares_ch_in(1,4)+total_shares_ch_eu(1,3)+total_shares_ch_eu(1,4)+total_shares_ch_ca(1,3)+total_shares_ch_ca(1,4))+...
w_ch_IT_us*h_ch_IT_us*total_shares_ch_us(1,1)+...
w_ch_IT_in*h_ch_IT_in*total_shares_ch_in(1,1)+...
w_ch_IT_eu*h_ch_IT_eu*total_shares_ch_eu(1,1)+...
w_ch_IT_ca*h_ch_IT_ca*total_shares_ch_ca(1,1)+...
w_ch_IT_ch*h_ch_IT_ch*total_shares_ch_ch(1,1)+...
w_ch_Man_us*h_ch_Man_us*total_shares_ch_us(1,2)+...
w_ch_Man_in*h_ch_Man_in*total_shares_ch_in(1,2)+...
w_ch_Man_eu*h_ch_Man_eu*total_shares_ch_eu(1,2)+...
w_ch_Man_ca*h_ch_Man_ca*total_shares_ch_ca(1,2)+...
w_ch_Man_ch*h_ch_Man_ch*total_shares_ch_ch(1,2)+...
w_ch_Oth_ch*h_ch_Oth_ch*total_shares_ch_ch(1,3)+...
L_ch*w_ch_L*(total_shares_ch_ch(1,8)+total_shares_ch_us(1,6)+total_shares_ch_eu(1,6)+total_shares_ch_ca(1,6)+total_shares_ch_in(1,6))+...
w_ch_Fin_us*h_ch_Fin_us*total_shares_ch_us(1,5)+...
w_ch_Fin_ch*h_ch_Fin_ch*total_shares_ch_ch(1,7)+...
w_ch_Fin_eu*h_ch_Fin_eu*total_shares_ch_eu(1,5)+...
w_ch_Fin_ca*h_ch_Fin_ca*total_shares_ch_ca(1,5)+...
w_ch_Fin_in*h_ch_Fin_in*total_shares_ch_in(1,5);


% exp_ot=L_ot*w_ot_L*(total_shares_ot(1,4)+total_shares_ot(1,5)+total_shares_ot(1,6))+...
% w_ot_IT_ot*h_ot_IT_ot*total_shares_ot(1,1)+...
% w_ot_Man_ot*h_ot_Man_ot*total_shares_ot(1,2)+...
% w_ot_Oth_ot*h_ot_Oth_ot*total_shares_ot(1,3);


%Normalization

exp_ot=(1-exp_in*Share_World_GDP(1,2)-exp_eu*Share_World_GDP(1,3)-exp_ca*Share_World_GDP(1,4)-exp_ch*Share_World_GDP(1,5)-exp_us*Share_World_GDP(1,1))/Share_World_GDP(1,6);




%Income

inc_us_IT=trade_us_us_IT*exp_us*Prod_shares_IT_us(1,1)+trade_in_us_IT*exp_in*Prod_shares_IT_us(1,2)+trade_eu_us_IT*exp_eu*Prod_shares_IT_us(1,3)+trade_ca_us_IT*exp_ca*Prod_shares_IT_us(1,4)+trade_ch_us_IT*exp_ch*Prod_shares_IT_us(1,5)+trade_ot_us_IT*exp_ot*Prod_shares_IT_us(1,6);
inc_us_Man=trade_us_us_Man*exp_us*Prod_shares_Man_us(1,1)+trade_in_us_Man*exp_in*Prod_shares_Man_us(1,2)+trade_eu_us_Man*exp_eu*Prod_shares_Man_us(1,3)+trade_ca_us_Man*exp_ca*Prod_shares_Man_us(1,4)+trade_ch_us_Man*exp_ch*Prod_shares_Man_us(1,5)+trade_ot_us_Man*exp_ot*Prod_shares_Man_us(1,6);
inc_us_Oth=trade_us_us_Oth*exp_us*Prod_shares_Oth_us(1,1)+trade_in_us_Oth*exp_in*Prod_shares_Oth_us(1,2)+trade_eu_us_Oth*exp_eu*Prod_shares_Oth_us(1,3)+trade_ca_us_Oth*exp_ca*Prod_shares_Oth_us(1,4)+trade_ch_us_Oth*exp_ch*Prod_shares_Oth_us(1,5)+trade_ot_us_Oth*exp_ot*Prod_shares_Oth_us(1,6);
inc_us_Fin=trade_us_us_Fin*exp_us*Prod_shares_Fin_us(1,1)+trade_in_us_Fin*exp_in*Prod_shares_Fin_us(1,2)+trade_eu_us_Fin*exp_eu*Prod_shares_Fin_us(1,3)+trade_ca_us_Fin*exp_ca*Prod_shares_Fin_us(1,4)+trade_ch_us_Fin*exp_ch*Prod_shares_Fin_us(1,5)+trade_ot_us_Fin*exp_ot*Prod_shares_Fin_us(1,6);


inc_in_IT=trade_us_in_IT*exp_us*Prod_shares_IT_in(1,1)+trade_in_in_IT*exp_in*Prod_shares_IT_in(1,2)+trade_eu_in_IT*exp_eu*Prod_shares_IT_in(1,3)+trade_ca_in_IT*exp_ca*Prod_shares_IT_in(1,4)+trade_ch_in_IT*exp_ch*Prod_shares_IT_in(1,5)+trade_ot_in_IT*exp_ot*Prod_shares_IT_in(1,6);
inc_in_Man=trade_us_in_Man*exp_us*Prod_shares_Man_in(1,1)+trade_in_in_Man*exp_in*Prod_shares_Man_in(1,2)+trade_eu_in_Man*exp_eu*Prod_shares_Man_in(1,3)+trade_ca_in_Man*exp_ca*Prod_shares_Man_in(1,4)+trade_ch_in_Man*exp_ch*Prod_shares_Man_in(1,5)+trade_ot_in_Man*exp_ot*Prod_shares_Man_in(1,6);
inc_in_Oth=trade_us_in_Oth*exp_us*Prod_shares_Oth_in(1,1)+trade_in_in_Oth*exp_in*Prod_shares_Oth_in(1,2)+trade_eu_in_Oth*exp_eu*Prod_shares_Oth_in(1,3)+trade_ca_in_Oth*exp_ca*Prod_shares_Oth_in(1,4)+trade_ch_in_Oth*exp_ch*Prod_shares_Oth_in(1,5)+trade_ot_in_Oth*exp_ot*Prod_shares_Oth_in(1,6);
inc_in_Fin=trade_us_in_Fin*exp_us*Prod_shares_Fin_in(1,1)+trade_in_in_Fin*exp_in*Prod_shares_Fin_in(1,2)+trade_eu_in_Fin*exp_eu*Prod_shares_Fin_in(1,3)+trade_ca_in_Fin*exp_ca*Prod_shares_Fin_in(1,4)+trade_ch_in_Fin*exp_ch*Prod_shares_Fin_in(1,5)+trade_ot_in_Fin*exp_ot*Prod_shares_Fin_in(1,6);

inc_eu_IT=trade_us_eu_IT*exp_us*Prod_shares_IT_eu(1,1)+trade_in_eu_IT*exp_in*Prod_shares_IT_eu(1,2)+trade_eu_eu_IT*exp_eu*Prod_shares_IT_eu(1,3)+trade_ca_eu_IT*exp_ca*Prod_shares_IT_eu(1,4)+trade_ch_eu_IT*exp_ch*Prod_shares_IT_eu(1,5)+trade_ot_eu_IT*exp_ot*Prod_shares_IT_eu(1,6);
inc_eu_Man=trade_us_eu_Man*exp_us*Prod_shares_Man_eu(1,1)+trade_in_eu_Man*exp_in*Prod_shares_Man_eu(1,2)+trade_eu_eu_Man*exp_eu*Prod_shares_Man_eu(1,3)+trade_ca_eu_Man*exp_ca*Prod_shares_Man_eu(1,4)+trade_ch_eu_Man*exp_ch*Prod_shares_Man_eu(1,5)+trade_ot_eu_Man*exp_ot*Prod_shares_Man_eu(1,6);
inc_eu_Oth=trade_us_eu_Oth*exp_us*Prod_shares_Oth_eu(1,1)+trade_in_eu_Oth*exp_in*Prod_shares_Oth_eu(1,2)+trade_eu_eu_Oth*exp_eu*Prod_shares_Oth_eu(1,3)+trade_ca_eu_Oth*exp_ca*Prod_shares_Oth_eu(1,4)+trade_ch_eu_Oth*exp_ch*Prod_shares_Oth_eu(1,5)+trade_ot_eu_Oth*exp_ot*Prod_shares_Oth_eu(1,6);
inc_eu_Fin=trade_us_eu_Fin*exp_us*Prod_shares_Fin_eu(1,1)+trade_in_eu_Fin*exp_in*Prod_shares_Fin_eu(1,2)+trade_eu_eu_Fin*exp_eu*Prod_shares_Fin_eu(1,3)+trade_ca_eu_Fin*exp_ca*Prod_shares_Fin_eu(1,4)+trade_ch_eu_Fin*exp_ch*Prod_shares_Fin_eu(1,5)+trade_ot_eu_Fin*exp_ot*Prod_shares_Fin_eu(1,6);

inc_ca_IT=trade_us_ca_IT*exp_us*Prod_shares_IT_ca(1,1)+trade_in_ca_IT*exp_in*Prod_shares_IT_ca(1,2)+trade_eu_ca_IT*exp_eu*Prod_shares_IT_ca(1,3)+trade_ca_ca_IT*exp_ca*Prod_shares_IT_ca(1,4)+trade_ch_ca_IT*exp_ch*Prod_shares_IT_ca(1,5)+trade_ot_ca_IT*exp_ot*Prod_shares_IT_ca(1,6);
inc_ca_Man=trade_us_ca_Man*exp_us*Prod_shares_Man_ca(1,1)+trade_in_ca_Man*exp_in*Prod_shares_Man_ca(1,2)+trade_eu_ca_Man*exp_eu*Prod_shares_Man_ca(1,3)+trade_ca_ca_Man*exp_ca*Prod_shares_Man_ca(1,4)+trade_ch_ca_Man*exp_ch*Prod_shares_Man_ca(1,5)+trade_ot_ca_Man*exp_ot*Prod_shares_Man_ca(1,6);
inc_ca_Oth=trade_us_ca_Oth*exp_us*Prod_shares_Oth_ca(1,1)+trade_in_ca_Oth*exp_in*Prod_shares_Oth_ca(1,2)+trade_eu_ca_Oth*exp_eu*Prod_shares_Oth_ca(1,3)+trade_ca_ca_Oth*exp_ca*Prod_shares_Oth_ca(1,4)+trade_ch_ca_Oth*exp_ch*Prod_shares_Oth_ca(1,5)+trade_ot_ca_Oth*exp_ot*Prod_shares_Oth_ca(1,6);
inc_ca_Fin=trade_us_ca_Fin*exp_us*Prod_shares_Fin_ca(1,1)+trade_in_ca_Fin*exp_in*Prod_shares_Fin_ca(1,2)+trade_eu_ca_Fin*exp_eu*Prod_shares_Fin_ca(1,3)+trade_ca_ca_Fin*exp_ca*Prod_shares_Fin_ca(1,4)+trade_ch_ca_Fin*exp_ch*Prod_shares_Fin_ca(1,5)+trade_ot_ca_Fin*exp_ot*Prod_shares_Fin_ca(1,6);

inc_ch_IT=trade_us_ch_IT*exp_us*Prod_shares_IT_ch(1,1)+trade_in_ch_IT*exp_in*Prod_shares_IT_ch(1,2)+trade_eu_ch_IT*exp_eu*Prod_shares_IT_ch(1,3)+trade_ca_ch_IT*exp_ca*Prod_shares_IT_ch(1,4)+trade_ch_ch_IT*exp_ch*Prod_shares_IT_ch(1,5)+trade_ot_ch_IT*exp_ot*Prod_shares_IT_ch(1,6);
inc_ch_Man=trade_us_ch_Man*exp_us*Prod_shares_Man_ch(1,1)+trade_in_ch_Man*exp_in*Prod_shares_Man_ch(1,2)+trade_eu_ch_Man*exp_eu*Prod_shares_Man_ch(1,3)+trade_ca_ch_Man*exp_ca*Prod_shares_Man_ch(1,4)+trade_ch_ch_Man*exp_ch*Prod_shares_Man_ch(1,5)+trade_ot_ch_Man*exp_ot*Prod_shares_Man_ch(1,6);
inc_ch_Oth=trade_us_ch_Oth*exp_us*Prod_shares_Oth_ch(1,1)+trade_in_ch_Oth*exp_in*Prod_shares_Oth_ch(1,2)+trade_eu_ch_Oth*exp_eu*Prod_shares_Oth_ch(1,3)+trade_ca_ch_Oth*exp_ca*Prod_shares_Oth_ch(1,4)+trade_ch_ch_Oth*exp_ch*Prod_shares_Oth_ch(1,5)+trade_ot_ch_Oth*exp_ot*Prod_shares_Oth_ch(1,6);
inc_ch_Fin=trade_us_ch_Fin*exp_us*Prod_shares_Fin_ch(1,1)+trade_in_ch_Fin*exp_in*Prod_shares_Fin_ch(1,2)+trade_eu_ch_Fin*exp_eu*Prod_shares_Fin_ch(1,3)+trade_ca_ch_Fin*exp_ca*Prod_shares_Fin_ch(1,4)+trade_ch_ch_Fin*exp_ch*Prod_shares_Fin_ch(1,5)+trade_ot_ch_Fin*exp_ot*Prod_shares_Fin_ch(1,6);

inc_ot_IT=trade_us_ot_IT*exp_us*Prod_shares_IT_ot(1,1)+trade_in_ot_IT*exp_in*Prod_shares_IT_ot(1,2)+trade_eu_ot_IT*exp_eu*Prod_shares_IT_ot(1,3)+trade_ca_ot_IT*exp_ca*Prod_shares_IT_ot(1,4)+trade_ch_ot_IT*exp_ch*Prod_shares_IT_ot(1,5)+trade_ot_ot_IT*exp_ot*Prod_shares_IT_ot(1,6);
inc_ot_Man=trade_us_ot_Man*exp_us*Prod_shares_Man_ot(1,1)+trade_in_ot_Man*exp_in*Prod_shares_Man_ot(1,2)+trade_eu_ot_Man*exp_eu*Prod_shares_Man_ot(1,3)+trade_ca_ot_Man*exp_ca*Prod_shares_Man_ot(1,4)+trade_ch_ot_Man*exp_ch*Prod_shares_Man_ot(1,5)+trade_ot_ot_Man*exp_ot*Prod_shares_Man_ot(1,6);
inc_ot_Oth=trade_us_ot_Oth*exp_us*Prod_shares_Oth_ot(1,1)+trade_in_ot_Oth*exp_in*Prod_shares_Oth_ot(1,2)+trade_eu_ot_Oth*exp_eu*Prod_shares_Oth_ot(1,3)+trade_ca_ot_Oth*exp_ca*Prod_shares_Oth_ot(1,4)+trade_ch_ot_Oth*exp_ch*Prod_shares_Oth_ot(1,5)+trade_ot_ot_Oth*exp_ot*Prod_shares_Oth_ot(1,6);
inc_ot_Fin=trade_us_ot_Fin*exp_us*Prod_shares_Fin_ot(1,1)+trade_in_ot_Fin*exp_in*Prod_shares_Fin_ot(1,2)+trade_eu_ot_Fin*exp_eu*Prod_shares_Fin_ot(1,3)+trade_ca_ot_Fin*exp_ca*Prod_shares_Fin_ot(1,4)+trade_ch_ot_Fin*exp_ch*Prod_shares_Fin_ot(1,5)+trade_ot_ot_Fin*exp_ot*Prod_shares_Fin_ot(1,6);

%Low-skill labor supply

l_us_IT_us=inc_us_IT*mne_us_us_IT*lowshare_us_IT_us/w_us_L;
l_us_IT_in=inc_us_IT*mne_us_in_IT*lowshare_us_IT_in/w_us_L;
l_us_IT_eu=inc_us_IT*mne_us_eu_IT*lowshare_us_IT_eu/w_us_L;
l_us_IT_ca=inc_us_IT*mne_us_ca_IT*lowshare_us_IT_ca/w_us_L;
l_us_IT_ch=inc_us_IT*mne_us_ch_IT*lowshare_us_IT_ch/w_us_L;

l_us_Man_us=inc_us_Man*mne_us_us_Man*lowshare_us_Man_us/w_us_L;
l_us_Man_in=inc_us_Man*mne_us_in_Man*lowshare_us_Man_in/w_us_L;
l_us_Man_eu=inc_us_Man*mne_us_eu_Man*lowshare_us_Man_eu/w_us_L;
l_us_Man_ca=inc_us_Man*mne_us_ca_Man*lowshare_us_Man_ca/w_us_L;
l_us_Man_ch=inc_us_Man*mne_us_ch_Man*lowshare_us_Man_ch/w_us_L;


l_us_Oth_us=inc_us_Oth*lowshare_us_Oth_us/w_us_L;


l_us_Fin_us=inc_us_Fin*mne_us_us_Fin*lowshare_us_Fin_us/w_us_L;
l_us_Fin_in=inc_us_Fin*mne_us_in_Fin*lowshare_us_Fin_in/w_us_L;
l_us_Fin_eu=inc_us_Fin*mne_us_eu_Fin*lowshare_us_Fin_eu/w_us_L;
l_us_Fin_ca=inc_us_Fin*mne_us_ca_Fin*lowshare_us_Fin_ca/w_us_L;
l_us_Fin_ch=inc_us_Fin*mne_us_ch_Fin*lowshare_us_Fin_ch/w_us_L;


%India
l_in_IT_us=inc_in_IT*mne_in_us_IT*lowshare_in_IT_us/w_in_L;
l_in_IT_in=inc_in_IT*mne_in_in_IT*lowshare_in_IT_in/w_in_L;
l_in_IT_eu=inc_in_IT*mne_in_eu_IT*lowshare_in_IT_eu/w_in_L;
l_in_IT_ca=inc_in_IT*mne_in_ca_IT*lowshare_in_IT_ca/w_in_L;
l_in_IT_ch=inc_in_IT*mne_in_ch_IT*lowshare_in_IT_ch/w_in_L;


l_in_Man_us=inc_in_Man*mne_in_us_Man*lowshare_in_Man_us/w_in_L;
l_in_Man_in=inc_in_Man*mne_in_in_Man*lowshare_in_Man_in/w_in_L;
l_in_Man_eu=inc_in_Man*mne_in_eu_Man*lowshare_in_Man_eu/w_in_L;
l_in_Man_ca=inc_in_Man*mne_in_ca_Man*lowshare_in_Man_ca/w_in_L;
l_in_Man_ch=inc_in_Man*mne_in_ch_Man*lowshare_in_Man_ch/w_in_L;


l_in_Oth_in=inc_in_Oth*lowshare_in_Oth_in/w_in_L;


l_in_Fin_us=inc_in_Fin*mne_in_us_Fin*lowshare_in_Fin_us/w_in_L;
l_in_Fin_in=inc_in_Fin*mne_in_in_Fin*lowshare_in_Fin_in/w_in_L;
l_in_Fin_eu=inc_in_Fin*mne_in_eu_Fin*lowshare_in_Fin_eu/w_in_L;
l_in_Fin_ca=inc_in_Fin*mne_in_ca_Fin*lowshare_in_Fin_ca/w_in_L;
l_in_Fin_ch=inc_in_Fin*mne_in_ch_Fin*lowshare_in_Fin_ch/w_in_L;


%Europe

l_eu_IT_us=inc_eu_IT*mne_eu_us_IT*lowshare_eu_IT_us/w_eu_L;
l_eu_IT_in=inc_eu_IT*mne_eu_in_IT*lowshare_eu_IT_in/w_eu_L;
l_eu_IT_eu=inc_eu_IT*mne_eu_eu_IT*lowshare_eu_IT_eu/w_eu_L;
l_eu_IT_ca=inc_eu_IT*mne_eu_ca_IT*lowshare_eu_IT_ca/w_eu_L;
l_eu_IT_ch=inc_eu_IT*mne_eu_ch_IT*lowshare_eu_IT_ch/w_eu_L;


l_eu_Man_us=inc_eu_Man*mne_eu_us_Man*lowshare_eu_Man_us/w_eu_L;
l_eu_Man_in=inc_eu_Man*mne_eu_in_Man*lowshare_eu_Man_in/w_eu_L;
l_eu_Man_eu=inc_eu_Man*mne_eu_eu_Man*lowshare_eu_Man_eu/w_eu_L;
l_eu_Man_ca=inc_eu_Man*mne_eu_ca_Man*lowshare_eu_Man_ca/w_eu_L;
l_eu_Man_ch=inc_eu_Man*mne_eu_ch_Man*lowshare_eu_Man_ch/w_eu_L;


l_eu_Oth_eu=inc_eu_Oth*lowshare_eu_Oth_eu/w_eu_L;

l_eu_Fin_us=inc_eu_Fin*mne_eu_us_Fin*lowshare_eu_Fin_us/w_eu_L;
l_eu_Fin_in=inc_eu_Fin*mne_eu_in_Fin*lowshare_eu_Fin_in/w_eu_L;
l_eu_Fin_eu=inc_eu_Fin*mne_eu_eu_Fin*lowshare_eu_Fin_eu/w_eu_L;
l_eu_Fin_ca=inc_eu_Fin*mne_eu_ca_Fin*lowshare_eu_Fin_ca/w_eu_L;
l_eu_Fin_ch=inc_eu_Fin*mne_eu_ch_Fin*lowshare_eu_Fin_ch/w_eu_L;


%Canada

l_ca_IT_us=inc_ca_IT*mne_ca_us_IT*lowshare_ca_IT_us/w_ca_L;
l_ca_IT_in=inc_ca_IT*mne_ca_in_IT*lowshare_ca_IT_in/w_ca_L;
l_ca_IT_eu=inc_ca_IT*mne_ca_eu_IT*lowshare_ca_IT_eu/w_ca_L;
l_ca_IT_ca=inc_ca_IT*mne_ca_ca_IT*lowshare_ca_IT_ca/w_ca_L;
l_ca_IT_ch=inc_ca_IT*mne_ca_ch_IT*lowshare_ca_IT_ch/w_ca_L;


l_ca_Man_us=inc_ca_Man*mne_ca_us_Man*lowshare_ca_Man_us/w_ca_L;
l_ca_Man_in=inc_ca_Man*mne_ca_in_Man*lowshare_ca_Man_in/w_ca_L;
l_ca_Man_eu=inc_ca_Man*mne_ca_eu_Man*lowshare_ca_Man_eu/w_ca_L;
l_ca_Man_ca=inc_ca_Man*mne_ca_ca_Man*lowshare_ca_Man_ca/w_ca_L;
l_ca_Man_ch=inc_ca_Man*mne_ca_ch_Man*lowshare_ca_Man_ch/w_ca_L;

l_ca_Oth_ca=inc_ca_Oth*lowshare_ca_Oth_ca/w_ca_L;

l_ca_Fin_us=inc_ca_Fin*mne_ca_us_Fin*lowshare_ca_Fin_us/w_ca_L;
l_ca_Fin_in=inc_ca_Fin*mne_ca_in_Fin*lowshare_ca_Fin_in/w_ca_L;
l_ca_Fin_eu=inc_ca_Fin*mne_ca_eu_Fin*lowshare_ca_Fin_eu/w_ca_L;
l_ca_Fin_ca=inc_ca_Fin*mne_ca_ca_Fin*lowshare_ca_Fin_ca/w_ca_L;
l_ca_Fin_ch=inc_ca_Fin*mne_ca_ch_Fin*lowshare_ca_Fin_ch/w_ca_L;

%China

l_ch_IT_us=inc_ch_IT*mne_ch_us_IT*lowshare_ch_IT_us/w_ch_L;
l_ch_IT_in=inc_ch_IT*mne_ch_in_IT*lowshare_ch_IT_in/w_ch_L;
l_ch_IT_eu=inc_ch_IT*mne_ch_eu_IT*lowshare_ch_IT_eu/w_ch_L;
l_ch_IT_ca=inc_ch_IT*mne_ch_ca_IT*lowshare_ch_IT_ca/w_ch_L;
l_ch_IT_ch=inc_ch_IT*mne_ch_ch_IT*lowshare_ch_IT_ch/w_ch_L;


l_ch_Man_us=inc_ch_Man*mne_ch_us_Man*lowshare_ch_Man_us/w_ch_L;
l_ch_Man_in=inc_ch_Man*mne_ch_in_Man*lowshare_ch_Man_in/w_ch_L;
l_ch_Man_eu=inc_ch_Man*mne_ch_eu_Man*lowshare_ch_Man_eu/w_ch_L;
l_ch_Man_ca=inc_ch_Man*mne_ch_ca_Man*lowshare_ch_Man_ca/w_ch_L;
l_ch_Man_ch=inc_ch_Man*mne_ch_ch_Man*lowshare_ch_Man_ch/w_ch_L;


l_ch_Oth_ch=inc_ch_Oth*lowshare_ch_Oth_ch/w_ch_L;

l_ch_Fin_us=inc_ch_Fin*mne_ch_us_Fin*lowshare_ch_Fin_us/w_ch_L;
l_ch_Fin_in=inc_ch_Fin*mne_ch_in_Fin*lowshare_ch_Fin_in/w_ch_L;
l_ch_Fin_eu=inc_ch_Fin*mne_ch_eu_Fin*lowshare_ch_Fin_eu/w_ch_L;
l_ch_Fin_ca=inc_ch_Fin*mne_ch_ca_Fin*lowshare_ch_Fin_ca/w_ch_L;
l_ch_Fin_ch=inc_ch_Fin*mne_ch_ch_Fin*lowshare_ch_Fin_ch/w_ch_L;


%Other

l_ot_IT_ot=inc_ot_IT*lowshare_ot_IT_ot/w_ot_L;
l_ot_Man_ot=inc_ot_Man*lowshare_ot_Man_ot/w_ot_L;
l_ot_Oth_ot=inc_ot_Oth*lowshare_ot_Oth_ot/w_ot_L;
l_ot_Fin_ot=inc_ot_Fin*lowshare_ot_Fin_ot/w_ot_L;




%Market clearing equilibrium
%Define quantities of high-skill and low-skill labor

%US

alt_h_us_IT_us_d=inc_us_IT*mne_us_us_IT*hshare_us_IT_us_d*highshare_us_IT_us/w_us_IT_us_d;
alt_h_us_IT_us_f=inc_us_IT*mne_us_us_IT*hshare_us_IT_us_f*highshare_us_IT_us/w_us_IT_us_f;

alt_h_us_IT_in_d=inc_us_IT*mne_us_in_IT*hshare_us_IT_in_d*highshare_us_IT_in/w_us_IT_in_d;
alt_h_us_IT_in_s=inc_us_IT*mne_us_in_IT*hshare_us_IT_in_fs*hshare_us_IT_in_s*highshare_us_IT_in/w_us_IT_in_s;
alt_h_us_IT_in_f=inc_us_IT*mne_us_in_IT*hshare_us_IT_in_fs*hshare_us_IT_in_f*highshare_us_IT_in/w_us_IT_in_f;

alt_h_us_IT_eu_d=inc_us_IT*mne_us_eu_IT*hshare_us_IT_eu_d*highshare_us_IT_eu/w_us_IT_eu_d;
alt_h_us_IT_eu_s=inc_us_IT*mne_us_eu_IT*hshare_us_IT_eu_fs*hshare_us_IT_eu_s*highshare_us_IT_eu/w_us_IT_eu_s;
alt_h_us_IT_eu_f=inc_us_IT*mne_us_eu_IT*hshare_us_IT_eu_fs*hshare_us_IT_eu_f*highshare_us_IT_eu/w_us_IT_eu_f;

alt_h_us_IT_ca_d=inc_us_IT*mne_us_ca_IT*hshare_us_IT_ca_d*highshare_us_IT_ca/w_us_IT_ca_d;
alt_h_us_IT_ca_s=inc_us_IT*mne_us_ca_IT*hshare_us_IT_ca_fs*hshare_us_IT_ca_s*highshare_us_IT_ca/w_us_IT_ca_s;
alt_h_us_IT_ca_f=inc_us_IT*mne_us_ca_IT*hshare_us_IT_ca_fs*hshare_us_IT_ca_f*highshare_us_IT_ca/w_us_IT_ca_f;

alt_h_us_IT_ch_d=inc_us_IT*mne_us_ch_IT*hshare_us_IT_ch_d*highshare_us_IT_ch/w_us_IT_ch_d;
alt_h_us_IT_ch_s=inc_us_IT*mne_us_ch_IT*hshare_us_IT_ch_fs*hshare_us_IT_ch_s*highshare_us_IT_ch/w_us_IT_ch_s;
alt_h_us_IT_ch_f=inc_us_IT*mne_us_ch_IT*hshare_us_IT_ch_fs*hshare_us_IT_ch_f*highshare_us_IT_ch/w_us_IT_ch_f;

alt_h_us_Man_us_d=inc_us_Man*mne_us_us_Man*hshare_us_Man_us_d*highshare_us_Man_us/w_us_Man_us_d;
alt_h_us_Man_us_f=inc_us_Man*mne_us_us_Man*hshare_us_Man_us_f*highshare_us_Man_us/w_us_Man_us_f;

alt_h_us_Man_in_d=inc_us_Man*mne_us_in_Man*hshare_us_Man_in_d*highshare_us_Man_in/w_us_Man_in_d;
alt_h_us_Man_in_s=inc_us_Man*mne_us_in_Man*hshare_us_Man_in_fs*hshare_us_Man_in_s*highshare_us_Man_in/w_us_Man_in_s;
alt_h_us_Man_in_f=inc_us_Man*mne_us_in_Man*hshare_us_Man_in_fs*hshare_us_Man_in_f*highshare_us_Man_in/w_us_Man_in_f;

alt_h_us_Man_eu_d=inc_us_Man*mne_us_eu_Man*hshare_us_Man_eu_d*highshare_us_Man_eu/w_us_Man_eu_d;
alt_h_us_Man_eu_s=inc_us_Man*mne_us_eu_Man*hshare_us_Man_eu_fs*hshare_us_Man_eu_s*highshare_us_Man_eu/w_us_Man_eu_s;
alt_h_us_Man_eu_f=inc_us_Man*mne_us_eu_Man*hshare_us_Man_eu_fs*hshare_us_Man_eu_f*highshare_us_Man_eu/w_us_Man_eu_f;

alt_h_us_Man_ca_d=inc_us_Man*mne_us_ca_Man*hshare_us_Man_ca_d*highshare_us_Man_ca/w_us_Man_ca_d;
alt_h_us_Man_ca_s=inc_us_Man*mne_us_ca_Man*hshare_us_Man_ca_fs*hshare_us_Man_ca_s*highshare_us_Man_ca/w_us_Man_ca_s;
alt_h_us_Man_ca_f=inc_us_Man*mne_us_ca_Man*hshare_us_Man_ca_fs*hshare_us_Man_ca_f*highshare_us_Man_ca/w_us_Man_ca_f;

alt_h_us_Man_ch_d=inc_us_Man*mne_us_ch_Man*hshare_us_Man_ch_d*highshare_us_Man_ch/w_us_Man_ch_d;
alt_h_us_Man_ch_s=inc_us_Man*mne_us_ch_Man*hshare_us_Man_ch_fs*hshare_us_Man_ch_s*highshare_us_Man_ch/w_us_Man_ch_s;
alt_h_us_Man_ch_f=inc_us_Man*mne_us_ch_Man*hshare_us_Man_ch_fs*hshare_us_Man_ch_f*highshare_us_Man_ch/w_us_Man_ch_f;

alt_h_us_Oth_us_d=inc_us_Oth*hshare_us_Oth_us_d*highshare_us_Oth_us/w_us_Oth_us_d;
alt_h_us_Oth_us_f=inc_us_Oth*hshare_us_Oth_us_f*highshare_us_Oth_us/w_us_Oth_us_f;

alt_h_us_Fin_us_d=inc_us_Fin*mne_us_us_Fin*hshare_us_Fin_us_d*highshare_us_Fin_us/w_us_Fin_us_d;
alt_h_us_Fin_us_f=inc_us_Fin*mne_us_us_Fin*hshare_us_Fin_us_f*highshare_us_Fin_us/w_us_Fin_us_f;

alt_h_us_Fin_in_d=inc_us_Fin*mne_us_in_Fin*hshare_us_Fin_in_d*highshare_us_Fin_in/w_us_Fin_in_d;
alt_h_us_Fin_in_s=inc_us_Fin*mne_us_in_Fin*hshare_us_Fin_in_fs*hshare_us_Fin_in_s*highshare_us_Fin_in/w_us_Fin_in_s;
alt_h_us_Fin_in_f=inc_us_Fin*mne_us_in_Fin*hshare_us_Fin_in_fs*hshare_us_Fin_in_f*highshare_us_Fin_in/w_us_Fin_in_f;

alt_h_us_Fin_eu_d=inc_us_Fin*mne_us_eu_Fin*hshare_us_Fin_eu_d*highshare_us_Fin_eu/w_us_Fin_eu_d;
alt_h_us_Fin_eu_s=inc_us_Fin*mne_us_eu_Fin*hshare_us_Fin_eu_fs*hshare_us_Fin_eu_s*highshare_us_Fin_eu/w_us_Fin_eu_s;
alt_h_us_Fin_eu_f=inc_us_Fin*mne_us_eu_Fin*hshare_us_Fin_eu_fs*hshare_us_Fin_eu_f*highshare_us_Fin_eu/w_us_Fin_eu_f;

alt_h_us_Fin_ca_d=inc_us_Fin*mne_us_ca_Fin*hshare_us_Fin_ca_d*highshare_us_Fin_ca/w_us_Fin_ca_d;
alt_h_us_Fin_ca_s=inc_us_Fin*mne_us_ca_Fin*hshare_us_Fin_ca_fs*hshare_us_Fin_ca_s*highshare_us_Fin_ca/w_us_Fin_ca_s;
alt_h_us_Fin_ca_f=inc_us_Fin*mne_us_ca_Fin*hshare_us_Fin_ca_fs*hshare_us_Fin_ca_f*highshare_us_Fin_ca/w_us_Fin_ca_f;

alt_h_us_Fin_ch_d=inc_us_Fin*mne_us_ch_Fin*hshare_us_Fin_ch_d*highshare_us_Fin_ch/w_us_Fin_ch_d;
alt_h_us_Fin_ch_s=inc_us_Fin*mne_us_ch_Fin*hshare_us_Fin_ch_fs*hshare_us_Fin_ch_s*highshare_us_Fin_ch/w_us_Fin_ch_s;
alt_h_us_Fin_ch_f=inc_us_Fin*mne_us_ch_Fin*hshare_us_Fin_ch_fs*hshare_us_Fin_ch_f*highshare_us_Fin_ch/w_us_Fin_ch_f;

%Europe

alt_h_eu_IT_eu_d=inc_eu_IT*mne_eu_eu_IT*hshare_eu_IT_eu_d*highshare_eu_IT_eu/w_eu_IT_eu_d;
alt_h_eu_IT_eu_f=inc_eu_IT*mne_eu_eu_IT*hshare_eu_IT_eu_f*highshare_eu_IT_eu/w_eu_IT_eu_f;

alt_h_eu_IT_in_d=inc_eu_IT*mne_eu_in_IT*hshare_eu_IT_in_d*highshare_eu_IT_in/w_eu_IT_in_d;
alt_h_eu_IT_in_s=inc_eu_IT*mne_eu_in_IT*hshare_eu_IT_in_fs*hshare_eu_IT_in_s*highshare_eu_IT_in/w_eu_IT_in_s;
alt_h_eu_IT_in_f=inc_eu_IT*mne_eu_in_IT*hshare_eu_IT_in_fs*hshare_eu_IT_in_f*highshare_eu_IT_in/w_eu_IT_in_f;

alt_h_eu_IT_us_d=inc_eu_IT*mne_eu_us_IT*hshare_eu_IT_us_d*highshare_eu_IT_us/w_eu_IT_us_d;
alt_h_eu_IT_us_s=inc_eu_IT*mne_eu_us_IT*hshare_eu_IT_us_fs*hshare_eu_IT_us_s*highshare_eu_IT_us/w_eu_IT_us_s;
alt_h_eu_IT_us_f=inc_eu_IT*mne_eu_us_IT*hshare_eu_IT_us_fs*hshare_eu_IT_us_f*highshare_eu_IT_us/w_eu_IT_us_f;

alt_h_eu_IT_ca_d=inc_eu_IT*mne_eu_ca_IT*hshare_eu_IT_ca_d*highshare_eu_IT_ca/w_eu_IT_ca_d;
alt_h_eu_IT_ca_s=inc_eu_IT*mne_eu_ca_IT*hshare_eu_IT_ca_fs*hshare_eu_IT_ca_s*highshare_eu_IT_ca/w_eu_IT_ca_s;
alt_h_eu_IT_ca_f=inc_eu_IT*mne_eu_ca_IT*hshare_eu_IT_ca_fs*hshare_eu_IT_ca_f*highshare_eu_IT_ca/w_eu_IT_ca_f;

alt_h_eu_IT_ch_d=inc_eu_IT*mne_eu_ch_IT*hshare_eu_IT_ch_d*highshare_eu_IT_ch/w_eu_IT_ch_d;
alt_h_eu_IT_ch_s=inc_eu_IT*mne_eu_ch_IT*hshare_eu_IT_ch_fs*hshare_eu_IT_ch_s*highshare_eu_IT_ch/w_eu_IT_ch_s;
alt_h_eu_IT_ch_f=inc_eu_IT*mne_eu_ch_IT*hshare_eu_IT_ch_fs*hshare_eu_IT_ch_f*highshare_eu_IT_ch/w_eu_IT_ch_f;


alt_h_eu_Man_eu_d=inc_eu_Man*mne_eu_eu_Man*hshare_eu_Man_eu_d*highshare_eu_Man_eu/w_eu_Man_eu_d;
alt_h_eu_Man_eu_f=inc_eu_Man*mne_eu_eu_Man*hshare_eu_Man_eu_f*highshare_eu_Man_eu/w_eu_Man_eu_f;

alt_h_eu_Man_in_d=inc_eu_Man*mne_eu_in_Man*hshare_eu_Man_in_d*highshare_eu_Man_in/w_eu_Man_in_d;
alt_h_eu_Man_in_s=inc_eu_Man*mne_eu_in_Man*hshare_eu_Man_in_fs*hshare_eu_Man_in_s*highshare_eu_Man_in/w_eu_Man_in_s;
alt_h_eu_Man_in_f=inc_eu_Man*mne_eu_in_Man*hshare_eu_Man_in_fs*hshare_eu_Man_in_f*highshare_eu_Man_in/w_eu_Man_in_f;

alt_h_eu_Man_us_d=inc_eu_Man*mne_eu_us_Man*hshare_eu_Man_us_d*highshare_eu_Man_us/w_eu_Man_us_d;
alt_h_eu_Man_us_s=inc_eu_Man*mne_eu_us_Man*hshare_eu_Man_us_fs*hshare_eu_Man_us_s*highshare_eu_Man_us/w_eu_Man_us_s;
alt_h_eu_Man_us_f=inc_eu_Man*mne_eu_us_Man*hshare_eu_Man_us_fs*hshare_eu_Man_us_f*highshare_eu_Man_us/w_eu_Man_us_f;

alt_h_eu_Man_ca_d=inc_eu_Man*mne_eu_ca_Man*hshare_eu_Man_ca_d*highshare_eu_Man_ca/w_eu_Man_ca_d;
alt_h_eu_Man_ca_s=inc_eu_Man*mne_eu_ca_Man*hshare_eu_Man_ca_fs*hshare_eu_Man_ca_s*highshare_eu_Man_ca/w_eu_Man_ca_s;
alt_h_eu_Man_ca_f=inc_eu_Man*mne_eu_ca_Man*hshare_eu_Man_ca_fs*hshare_eu_Man_ca_f*highshare_eu_Man_ca/w_eu_Man_ca_f;

alt_h_eu_Man_ch_d=inc_eu_Man*mne_eu_ch_Man*hshare_eu_Man_ch_d*highshare_eu_Man_ch/w_eu_Man_ch_d;
alt_h_eu_Man_ch_s=inc_eu_Man*mne_eu_ch_Man*hshare_eu_Man_ch_fs*hshare_eu_Man_ch_s*highshare_eu_Man_ch/w_eu_Man_ch_s;
alt_h_eu_Man_ch_f=inc_eu_Man*mne_eu_ch_Man*hshare_eu_Man_ch_fs*hshare_eu_Man_ch_f*highshare_eu_Man_ch/w_eu_Man_ch_f;

alt_h_eu_Oth_eu_d=inc_eu_Oth*hshare_eu_Oth_eu_d*highshare_eu_Oth_eu/w_eu_Oth_eu_d;
alt_h_eu_Oth_eu_f=inc_eu_Oth*hshare_eu_Oth_eu_f*highshare_eu_Oth_eu/w_eu_Oth_eu_f;

alt_h_eu_Fin_eu_d=inc_eu_Fin*mne_eu_eu_Fin*hshare_eu_Fin_eu_d*highshare_eu_Fin_eu/w_eu_Fin_eu_d;
alt_h_eu_Fin_eu_f=inc_eu_Fin*mne_eu_eu_Fin*hshare_eu_Fin_eu_f*highshare_eu_Fin_eu/w_eu_Fin_eu_f;

alt_h_eu_Fin_in_d=inc_eu_Fin*mne_eu_in_Fin*hshare_eu_Fin_in_d*highshare_eu_Fin_in/w_eu_Fin_in_d;
alt_h_eu_Fin_in_s=inc_eu_Fin*mne_eu_in_Fin*hshare_eu_Fin_in_fs*hshare_eu_Fin_in_s*highshare_eu_Fin_in/w_eu_Fin_in_s;
alt_h_eu_Fin_in_f=inc_eu_Fin*mne_eu_in_Fin*hshare_eu_Fin_in_fs*hshare_eu_Fin_in_f*highshare_eu_Fin_in/w_eu_Fin_in_f;

alt_h_eu_Fin_us_d=inc_eu_Fin*mne_eu_us_Fin*hshare_eu_Fin_us_d*highshare_eu_Fin_us/w_eu_Fin_us_d;
alt_h_eu_Fin_us_s=inc_eu_Fin*mne_eu_us_Fin*hshare_eu_Fin_us_fs*hshare_eu_Fin_us_s*highshare_eu_Fin_us/w_eu_Fin_us_s;
alt_h_eu_Fin_us_f=inc_eu_Fin*mne_eu_us_Fin*hshare_eu_Fin_us_fs*hshare_eu_Fin_us_f*highshare_eu_Fin_us/w_eu_Fin_us_f;

alt_h_eu_Fin_ca_d=inc_eu_Fin*mne_eu_ca_Fin*hshare_eu_Fin_ca_d*highshare_eu_Fin_ca/w_eu_Fin_ca_d;
alt_h_eu_Fin_ca_s=inc_eu_Fin*mne_eu_ca_Fin*hshare_eu_Fin_ca_fs*hshare_eu_Fin_ca_s*highshare_eu_Fin_ca/w_eu_Fin_ca_s;
alt_h_eu_Fin_ca_f=inc_eu_Fin*mne_eu_ca_Fin*hshare_eu_Fin_ca_fs*hshare_eu_Fin_ca_f*highshare_eu_Fin_ca/w_eu_Fin_ca_f;

alt_h_eu_Fin_ch_d=inc_eu_Fin*mne_eu_ch_Fin*hshare_eu_Fin_ch_d*highshare_eu_Fin_ch/w_eu_Fin_ch_d;
alt_h_eu_Fin_ch_s=inc_eu_Fin*mne_eu_ch_Fin*hshare_eu_Fin_ch_fs*hshare_eu_Fin_ch_s*highshare_eu_Fin_ch/w_eu_Fin_ch_s;
alt_h_eu_Fin_ch_f=inc_eu_Fin*mne_eu_ch_Fin*hshare_eu_Fin_ch_fs*hshare_eu_Fin_ch_f*highshare_eu_Fin_ch/w_eu_Fin_ch_f;



%Canada

alt_h_ca_IT_ca_d=inc_ca_IT*mne_ca_ca_IT*hshare_ca_IT_ca_d*highshare_ca_IT_ca/w_ca_IT_ca_d;
alt_h_ca_IT_ca_f=inc_ca_IT*mne_ca_ca_IT*hshare_ca_IT_ca_f*highshare_ca_IT_ca/w_ca_IT_ca_f;

alt_h_ca_IT_in_d=inc_ca_IT*mne_ca_in_IT*hshare_ca_IT_in_d*highshare_ca_IT_in/w_ca_IT_in_d;
alt_h_ca_IT_in_s=inc_ca_IT*mne_ca_in_IT*hshare_ca_IT_in_fs*hshare_ca_IT_in_s*highshare_ca_IT_in/w_ca_IT_in_s;
alt_h_ca_IT_in_f=inc_ca_IT*mne_ca_in_IT*hshare_ca_IT_in_fs*hshare_ca_IT_in_f*highshare_ca_IT_in/w_ca_IT_in_f;

alt_h_ca_IT_us_d=inc_ca_IT*mne_ca_us_IT*hshare_ca_IT_us_d*highshare_ca_IT_us/w_ca_IT_us_d;
alt_h_ca_IT_us_s=inc_ca_IT*mne_ca_us_IT*hshare_ca_IT_us_fs*hshare_ca_IT_us_s*highshare_ca_IT_us/w_ca_IT_us_s;
alt_h_ca_IT_us_f=inc_ca_IT*mne_ca_us_IT*hshare_ca_IT_us_fs*hshare_ca_IT_us_f*highshare_ca_IT_us/w_ca_IT_us_f;

alt_h_ca_IT_eu_d=inc_ca_IT*mne_ca_eu_IT*hshare_ca_IT_eu_d*highshare_ca_IT_eu/w_ca_IT_eu_d;
alt_h_ca_IT_eu_s=inc_ca_IT*mne_ca_eu_IT*hshare_ca_IT_eu_fs*hshare_ca_IT_eu_s*highshare_ca_IT_eu/w_ca_IT_eu_s;
alt_h_ca_IT_eu_f=inc_ca_IT*mne_ca_eu_IT*hshare_ca_IT_eu_fs*hshare_ca_IT_eu_f*highshare_ca_IT_eu/w_ca_IT_eu_f;

alt_h_ca_IT_ch_d=inc_ca_IT*mne_ca_ch_IT*hshare_ca_IT_ch_d*highshare_ca_IT_ch/w_ca_IT_ch_d;
alt_h_ca_IT_ch_s=inc_ca_IT*mne_ca_ch_IT*hshare_ca_IT_ch_fs*hshare_ca_IT_ch_s*highshare_ca_IT_ch/w_ca_IT_ch_s;
alt_h_ca_IT_ch_f=inc_ca_IT*mne_ca_ch_IT*hshare_ca_IT_ch_fs*hshare_ca_IT_ch_f*highshare_ca_IT_ch/w_ca_IT_ch_f;


alt_h_ca_Man_ca_d=inc_ca_Man*mne_ca_ca_Man*hshare_ca_Man_ca_d*highshare_ca_Man_ca/w_ca_Man_ca_d;
alt_h_ca_Man_ca_f=inc_ca_Man*mne_ca_ca_Man*hshare_ca_Man_ca_f*highshare_ca_Man_ca/w_ca_Man_ca_f;

alt_h_ca_Man_in_d=inc_ca_Man*mne_ca_in_Man*hshare_ca_Man_in_d*highshare_ca_Man_in/w_ca_Man_in_d;
alt_h_ca_Man_in_s=inc_ca_Man*mne_ca_in_Man*hshare_ca_Man_in_fs*hshare_ca_Man_in_s*highshare_ca_Man_in/w_ca_Man_in_s;
alt_h_ca_Man_in_f=inc_ca_Man*mne_ca_in_Man*hshare_ca_Man_in_fs*hshare_ca_Man_in_f*highshare_ca_Man_in/w_ca_Man_in_f;

alt_h_ca_Man_us_d=inc_ca_Man*mne_ca_us_Man*hshare_ca_Man_us_d*highshare_ca_Man_us/w_ca_Man_us_d;
alt_h_ca_Man_us_s=inc_ca_Man*mne_ca_us_Man*hshare_ca_Man_us_fs*hshare_ca_Man_us_s*highshare_ca_Man_us/w_ca_Man_us_s;
alt_h_ca_Man_us_f=inc_ca_Man*mne_ca_us_Man*hshare_ca_Man_us_fs*hshare_ca_Man_us_f*highshare_ca_Man_us/w_ca_Man_us_f;

alt_h_ca_Man_eu_d=inc_ca_Man*mne_ca_eu_Man*hshare_ca_Man_eu_d*highshare_ca_Man_eu/w_ca_Man_eu_d;
alt_h_ca_Man_eu_s=inc_ca_Man*mne_ca_eu_Man*hshare_ca_Man_eu_fs*hshare_ca_Man_eu_s*highshare_ca_Man_eu/w_ca_Man_eu_s;
alt_h_ca_Man_eu_f=inc_ca_Man*mne_ca_eu_Man*hshare_ca_Man_eu_fs*hshare_ca_Man_eu_f*highshare_ca_Man_eu/w_ca_Man_eu_f;

alt_h_ca_Man_ch_d=inc_ca_Man*mne_ca_ch_Man*hshare_ca_Man_ch_d*highshare_ca_Man_ch/w_ca_Man_ch_d;
alt_h_ca_Man_ch_s=inc_ca_Man*mne_ca_ch_Man*hshare_ca_Man_eu_fs*hshare_ca_Man_ch_s*highshare_ca_Man_ch/w_ca_Man_ch_s;
alt_h_ca_Man_ch_f=inc_ca_Man*mne_ca_ch_Man*hshare_ca_Man_eu_fs*hshare_ca_Man_ch_f*highshare_ca_Man_ch/w_ca_Man_ch_f;

alt_h_ca_Oth_ca_d=inc_ca_Oth*hshare_ca_Oth_ca_d*highshare_ca_Oth_ca/w_ca_Oth_ca_d;
alt_h_ca_Oth_ca_f=inc_ca_Oth*hshare_ca_Oth_ca_f*highshare_ca_Oth_ca/w_ca_Oth_ca_f;

alt_h_ca_Fin_ca_d=inc_ca_Fin*mne_ca_ca_Fin*hshare_ca_Fin_ca_d*highshare_ca_Fin_ca/w_ca_Fin_ca_d;
alt_h_ca_Fin_ca_f=inc_ca_Fin*mne_ca_ca_Fin*hshare_ca_Fin_ca_f*highshare_ca_Fin_ca/w_ca_Fin_ca_f;

alt_h_ca_Fin_in_d=inc_ca_Fin*mne_ca_in_Fin*hshare_ca_Fin_in_d*highshare_ca_Fin_in/w_ca_Fin_in_d;
alt_h_ca_Fin_in_s=inc_ca_Fin*mne_ca_in_Fin*hshare_ca_Fin_in_fs*hshare_ca_Fin_in_s*highshare_ca_Fin_in/w_ca_Fin_in_s;
alt_h_ca_Fin_in_f=inc_ca_Fin*mne_ca_in_Fin*hshare_ca_Fin_in_fs*hshare_ca_Fin_in_f*highshare_ca_Fin_in/w_ca_Fin_in_f;

alt_h_ca_Fin_us_d=inc_ca_Fin*mne_ca_us_Fin*hshare_ca_Fin_us_d*highshare_ca_Fin_us/w_ca_Fin_us_d;
alt_h_ca_Fin_us_s=inc_ca_Fin*mne_ca_us_Fin*hshare_ca_Fin_us_fs*hshare_ca_Fin_us_s*highshare_ca_Fin_us/w_ca_Fin_us_s;
alt_h_ca_Fin_us_f=inc_ca_Fin*mne_ca_us_Fin*hshare_ca_Fin_us_fs*hshare_ca_Fin_us_f*highshare_ca_Fin_us/w_ca_Fin_us_f;

alt_h_ca_Fin_eu_d=inc_ca_Fin*mne_ca_eu_Fin*hshare_ca_Fin_eu_d*highshare_ca_Fin_eu/w_ca_Fin_eu_d;
alt_h_ca_Fin_eu_s=inc_ca_Fin*mne_ca_eu_Fin*hshare_ca_Fin_eu_fs*hshare_ca_Fin_eu_s*highshare_ca_Fin_eu/w_ca_Fin_eu_s;
alt_h_ca_Fin_eu_f=inc_ca_Fin*mne_ca_eu_Fin*hshare_ca_Fin_eu_fs*hshare_ca_Fin_eu_f*highshare_ca_Fin_eu/w_ca_Fin_eu_f;

alt_h_ca_Fin_ch_d=inc_ca_Fin*mne_ca_ch_Fin*hshare_ca_Fin_ch_d*highshare_ca_Fin_ch/w_ca_Fin_ch_d;
alt_h_ca_Fin_ch_s=inc_ca_Fin*mne_ca_ch_Fin*hshare_ca_Fin_eu_fs*hshare_ca_Fin_ch_s*highshare_ca_Fin_ch/w_ca_Fin_ch_s;
alt_h_ca_Fin_ch_f=inc_ca_Fin*mne_ca_ch_Fin*hshare_ca_Fin_eu_fs*hshare_ca_Fin_ch_f*highshare_ca_Fin_ch/w_ca_Fin_ch_f;

%India

alt_h_in_IT_us=inc_in_IT*mne_in_us_IT*highshare_in_IT_us/w_in_IT_us;
alt_h_in_IT_in=inc_in_IT*mne_in_in_IT*highshare_in_IT_in/w_in_IT_in;
alt_h_in_IT_eu=inc_in_IT*mne_in_eu_IT*highshare_in_IT_eu/w_in_IT_eu;
alt_h_in_IT_ca=inc_in_IT*mne_in_ca_IT*highshare_in_IT_ca/w_in_IT_ca;
alt_h_in_IT_ch=inc_in_IT*mne_in_ch_IT*highshare_in_IT_ch/w_in_IT_ch;


alt_h_in_Man_us=inc_in_Man*mne_in_us_Man*highshare_in_Man_us/w_in_Man_us;
alt_h_in_Man_in=inc_in_Man*mne_in_in_Man*highshare_in_Man_in/w_in_Man_in;
alt_h_in_Man_eu=inc_in_Man*mne_in_eu_Man*highshare_in_Man_eu/w_in_Man_eu;
alt_h_in_Man_ca=inc_in_Man*mne_in_ca_Man*highshare_in_Man_ca/w_in_Man_ca;
alt_h_in_Man_ch=inc_in_Man*mne_in_ch_Man*highshare_in_Man_ch/w_in_Man_ch;

alt_h_in_Oth_in=inc_in_Oth*highshare_in_Oth_in/w_in_Oth_in;

alt_h_in_Fin_us=inc_in_Fin*mne_in_us_Fin*highshare_in_Fin_us/w_in_Fin_us;
alt_h_in_Fin_in=inc_in_Fin*mne_in_in_Fin*highshare_in_Fin_in/w_in_Fin_in;
alt_h_in_Fin_eu=inc_in_Fin*mne_in_eu_Fin*highshare_in_Fin_eu/w_in_Fin_eu;
alt_h_in_Fin_ca=inc_in_Fin*mne_in_ca_Fin*highshare_in_Fin_ca/w_in_Fin_ca;
alt_h_in_Fin_ch=inc_in_Fin*mne_in_ch_Fin*highshare_in_Fin_ch/w_in_Fin_ch;

%China

alt_h_ch_IT_us=inc_ch_IT*mne_ch_us_IT*highshare_ch_IT_us/w_ch_IT_us;
alt_h_ch_IT_in=inc_ch_IT*mne_ch_in_IT*highshare_ch_IT_in/w_ch_IT_in;
alt_h_ch_IT_eu=inc_ch_IT*mne_ch_eu_IT*highshare_ch_IT_eu/w_ch_IT_eu;
alt_h_ch_IT_ca=inc_ch_IT*mne_ch_ca_IT*highshare_ch_IT_ca/w_ch_IT_ca;
alt_h_ch_IT_ch=inc_ch_IT*mne_ch_ch_IT*highshare_ch_IT_ch/w_ch_IT_ch;


alt_h_ch_Man_us=inc_ch_Man*mne_ch_us_Man*highshare_ch_Man_us/w_ch_Man_us;
alt_h_ch_Man_in=inc_ch_Man*mne_ch_in_Man*highshare_ch_Man_in/w_ch_Man_in;
alt_h_ch_Man_eu=inc_ch_Man*mne_ch_eu_Man*highshare_ch_Man_eu/w_ch_Man_eu;
alt_h_ch_Man_ca=inc_ch_Man*mne_ch_ca_Man*highshare_ch_Man_ca/w_ch_Man_ca;
alt_h_ch_Man_ch=inc_ch_Man*mne_ch_ch_Man*highshare_ch_Man_ch/w_ch_Man_ch;

alt_h_ch_Oth_ch=inc_ch_Oth*highshare_ch_Oth_ch/w_ch_Oth_ch;

alt_h_ch_Fin_us=inc_ch_Fin*mne_ch_us_Fin*highshare_ch_Fin_us/w_ch_Fin_us;
alt_h_ch_Fin_in=inc_ch_Fin*mne_ch_in_Fin*highshare_ch_Fin_in/w_ch_Fin_in;
alt_h_ch_Fin_eu=inc_ch_Fin*mne_ch_eu_Fin*highshare_ch_Fin_eu/w_ch_Fin_eu;
alt_h_ch_Fin_ca=inc_ch_Fin*mne_ch_ca_Fin*highshare_ch_Fin_ca/w_ch_Fin_ca;
alt_h_ch_Fin_ch=inc_ch_Fin*mne_ch_ch_Fin*highshare_ch_Fin_ch/w_ch_Fin_ch;

%Other

alt_h_ot_IT_ot=inc_ot_IT*highshare_ot_IT_ot/w_ot_IT_ot;
alt_h_ot_Man_ot=inc_ot_Man*highshare_ot_Man_ot/w_ot_Man_ot;
alt_h_ot_Oth_ot=inc_ot_Oth*highshare_ot_Oth_ot/w_ot_Oth_ot;
alt_h_ot_Fin_ot=inc_ot_Fin*highshare_ot_Fin_ot/w_ot_Fin_ot;



alt_L_us=l_us_IT_us*low_skill_share_us(1,1)+l_us_IT_in*low_skill_share_us(1,2)+l_us_IT_eu*low_skill_share_us(1,3)+l_us_IT_ca*low_skill_share_us(1,4)+...
    l_us_IT_ch*low_skill_share_us(1,5)+l_us_Man_us*low_skill_share_us(1,6)+l_us_Man_in*low_skill_share_us(1,7)+l_us_Man_eu*low_skill_share_us(1,8)+...
    l_us_Man_ca*low_skill_share_us(1,9)+l_us_Man_ch*low_skill_share_us(1,10)+l_us_Oth_us*low_skill_share_us(1,11)+l_us_Fin_us*low_skill_share_us(12)+...
    l_us_Fin_in*low_skill_share_us(1,13)+l_us_Fin_eu*low_skill_share_us(1,14)+...
    l_us_Fin_ca*low_skill_share_us(1,15)+l_us_Fin_ch*low_skill_share_us(1,16);


alt_L_in=l_in_IT_us*low_skill_share_in(1,1)+l_in_IT_in*low_skill_share_in(1,2)+l_in_IT_eu*low_skill_share_in(1,3)+l_in_IT_ca*low_skill_share_in(1,4)+...
    l_in_IT_ch*low_skill_share_in(1,5)+l_in_Man_us*low_skill_share_in(1,6)+l_in_Man_in*low_skill_share_in(1,7)+l_in_Man_eu*low_skill_share_in(1,8)+...
    l_in_Man_ca*low_skill_share_in(1,9)+l_in_Man_ch*low_skill_share_in(1,10)+l_in_Oth_in*low_skill_share_in(1,11)+l_in_Fin_us*low_skill_share_in(1,12)+...
    l_in_Fin_in*low_skill_share_in(1,13)+l_in_Fin_eu*low_skill_share_in(1,14)+...
    l_in_Fin_ca*low_skill_share_in(1,15)+l_in_Fin_ch*low_skill_share_in(1,16);

alt_L_eu=l_eu_IT_us*low_skill_share_eu(1,1)+l_eu_IT_in*low_skill_share_eu(1,2)+l_eu_IT_eu*low_skill_share_eu(1,3)+l_eu_IT_ca*low_skill_share_eu(1,4)+...
    l_eu_IT_ch*low_skill_share_eu(1,5)+l_eu_Man_us*low_skill_share_eu(1,6)+l_eu_Man_in*low_skill_share_eu(1,7)+l_eu_Man_eu*low_skill_share_eu(1,8)+...
    l_eu_Man_ca*low_skill_share_eu(1,9)+l_eu_Man_ch*low_skill_share_eu(1,10)+l_eu_Oth_eu*low_skill_share_eu(1,11)+l_eu_Fin_us*low_skill_share_eu(1,12)+...
    l_eu_Fin_in*low_skill_share_eu(1,13)+l_eu_Fin_eu*low_skill_share_eu(1,14)+...
    l_eu_Fin_ca*low_skill_share_eu(1,15)+l_eu_Fin_ch*low_skill_share_eu(1,16);

alt_L_ca=l_ca_IT_us*low_skill_share_ca(1,1)+l_ca_IT_in*low_skill_share_ca(1,2)+l_ca_IT_eu*low_skill_share_ca(1,3)+l_ca_IT_ca*low_skill_share_ca(1,4)+...
    l_ca_IT_ch*low_skill_share_ca(1,5)+l_ca_Man_us*low_skill_share_ca(1,6)+l_ca_Man_in*low_skill_share_ca(1,7)+l_ca_Man_eu*low_skill_share_ca(1,8)+...
    l_ca_Man_ca*low_skill_share_ca(1,9)+l_ca_Man_ch*low_skill_share_ca(1,10)+l_ca_Oth_ca*low_skill_share_ca(1,11)+l_ca_Fin_us*low_skill_share_ca(1,12)+...
    l_ca_Fin_in*low_skill_share_ca(1,13)+l_ca_Fin_eu*low_skill_share_ca(1,14)+...
    l_ca_Fin_ca*low_skill_share_ca(1,15)+l_ca_Fin_ch*low_skill_share_ca(1,16);

alt_L_ch=l_ch_IT_us*low_skill_share_ch(1,1)+l_ch_IT_in*low_skill_share_ch(1,2)+l_ch_IT_eu*low_skill_share_ch(1,3)+l_ch_IT_ca*low_skill_share_ch(1,4)+...
    l_ch_IT_ch*low_skill_share_ch(1,5)+l_ch_Man_us*low_skill_share_ch(1,6)+l_ch_Man_in*low_skill_share_ch(1,7)+l_ch_Man_eu*low_skill_share_ch(1,8)+...
    l_ch_Man_ca*low_skill_share_ch(1,9)+l_ch_Man_ch*low_skill_share_ch(1,10)+l_ch_Oth_ch*low_skill_share_ch(1,11)+l_ch_Fin_us*low_skill_share_ch(1,12)+...
    l_ch_Fin_in*low_skill_share_ch(1,13)+l_ch_Fin_eu*low_skill_share_ch(1,14)+...
    l_ch_Fin_ca*low_skill_share_ch(1,15)+l_ch_Fin_ch*low_skill_share_ch(1,16);

alt_L_ot=l_ot_IT_ot*low_skill_share_ot(1,1)+l_ot_Man_ot*low_skill_share_ot(1,2)+l_ot_Oth_ot*low_skill_share_ot(1,3)+l_ot_Fin_ot*low_skill_share_ot(1,4);



demand=[alt_h_us_IT_us_d alt_h_us_IT_us_f alt_h_us_IT_in_d alt_h_us_IT_in_s alt_h_us_IT_in_f alt_h_us_IT_eu_d alt_h_us_IT_eu_s alt_h_us_IT_eu_f alt_h_us_IT_ca_d alt_h_us_IT_ca_s ...
    alt_h_us_IT_ca_f alt_h_us_IT_ch_d alt_h_us_IT_ch_s alt_h_us_IT_ch_f alt_h_us_Man_us_d alt_h_us_Man_us_f alt_h_us_Man_in_d alt_h_us_Man_in_s alt_h_us_Man_in_f ...
    alt_h_us_Man_eu_d alt_h_us_Man_eu_s alt_h_us_Man_eu_f alt_h_us_Man_ca_d alt_h_us_Man_ca_s alt_h_us_Man_ca_f alt_h_us_Man_ch_d alt_h_us_Man_ch_s alt_h_us_Man_ch_f ...
    alt_h_us_Oth_us_d alt_h_us_Oth_us_f alt_h_eu_IT_eu_d alt_h_eu_IT_eu_f alt_h_eu_IT_in_d alt_h_eu_IT_in_s alt_h_eu_IT_in_f alt_h_eu_IT_us_d alt_h_eu_IT_us_s ...
    alt_h_eu_IT_us_f alt_h_eu_IT_ca_d alt_h_eu_IT_ca_s alt_h_eu_IT_ca_f alt_h_eu_IT_ch_d alt_h_eu_IT_ch_s alt_h_eu_IT_ch_f alt_h_eu_Man_eu_d alt_h_eu_Man_eu_f ...
    alt_h_eu_Man_in_d alt_h_eu_Man_in_s alt_h_eu_Man_in_f alt_h_eu_Man_us_d alt_h_eu_Man_us_s alt_h_eu_Man_us_f alt_h_eu_Man_ca_d alt_h_eu_Man_ca_s alt_h_eu_Man_ca_f ...
    alt_h_eu_Man_ch_d alt_h_eu_Man_ch_s alt_h_eu_Man_ch_f alt_h_eu_Oth_eu_d alt_h_eu_Oth_eu_f alt_h_ca_IT_ca_d alt_h_ca_IT_ca_f alt_h_ca_IT_in_d alt_h_ca_IT_in_s alt_h_ca_IT_in_f ...
    alt_h_ca_IT_us_d alt_h_ca_IT_us_s alt_h_ca_IT_us_f alt_h_ca_IT_eu_d alt_h_ca_IT_eu_s alt_h_ca_IT_eu_f alt_h_ca_IT_ch_d alt_h_ca_IT_ch_s alt_h_ca_IT_ch_f alt_h_ca_Man_ca_d ...
    alt_h_ca_Man_ca_f alt_h_ca_Man_in_d alt_h_ca_Man_in_s alt_h_ca_Man_in_f alt_h_ca_Man_us_d alt_h_ca_Man_us_s alt_h_ca_Man_us_f alt_h_ca_Man_eu_d alt_h_ca_Man_eu_s ...
    alt_h_ca_Man_eu_f alt_h_ca_Man_ch_d alt_h_ca_Man_ch_s alt_h_ca_Man_ch_f alt_h_ca_Oth_ca_d alt_h_ca_Oth_ca_f alt_h_in_IT_us alt_h_in_IT_in alt_h_in_IT_eu alt_h_in_IT_ca ...
    alt_h_in_IT_ch alt_h_in_Man_us alt_h_in_Man_in alt_h_in_Man_eu alt_h_in_Man_ca alt_h_in_Man_ch alt_h_in_Oth_in alt_h_ch_IT_us alt_h_ch_IT_in alt_h_ch_IT_eu alt_h_ch_IT_ca ...
    alt_h_ch_IT_ch alt_h_ch_Man_us alt_h_ch_Man_in alt_h_ch_Man_eu alt_h_ch_Man_ca alt_h_ch_Man_ch alt_h_ch_Oth_ch alt_h_ot_IT_ot alt_h_ot_Man_ot alt_h_ot_Oth_ot ...
    alt_L_us alt_L_in alt_L_eu alt_L_ca alt_L_ch alt_L_ot p_us_IT p_us_Man p_us_Oth p_in_IT p_in_Man p_in_Oth p_eu_IT p_eu_Man p_eu_Oth p_ca_IT p_ca_Man... 
    p_ca_Oth p_ch_IT p_ch_Man p_ch_Oth p_ot_IT p_ot_Man p_ot_Oth...
    alt_h_us_Fin_us_d alt_h_us_Fin_us_f alt_h_us_Fin_in_d alt_h_us_Fin_in_s alt_h_us_Fin_in_f ...
    alt_h_us_Fin_eu_d alt_h_us_Fin_eu_s alt_h_us_Fin_eu_f alt_h_us_Fin_ca_d alt_h_us_Fin_ca_s alt_h_us_Fin_ca_f alt_h_us_Fin_ch_d alt_h_us_Fin_ch_s alt_h_us_Fin_ch_f ...
    alt_h_eu_Fin_eu_d alt_h_eu_Fin_eu_f ...
    alt_h_eu_Fin_in_d alt_h_eu_Fin_in_s alt_h_eu_Fin_in_f alt_h_eu_Fin_us_d alt_h_eu_Fin_us_s alt_h_eu_Fin_us_f alt_h_eu_Fin_ca_d alt_h_eu_Fin_ca_s alt_h_eu_Fin_ca_f ...
    alt_h_eu_Fin_ch_d alt_h_eu_Fin_ch_s alt_h_eu_Fin_ch_f...
    alt_h_ca_Fin_ca_d ...
    alt_h_ca_Fin_ca_f alt_h_ca_Fin_in_d alt_h_ca_Fin_in_s alt_h_ca_Fin_in_f alt_h_ca_Fin_us_d alt_h_ca_Fin_us_s alt_h_ca_Fin_us_f alt_h_ca_Fin_eu_d alt_h_ca_Fin_eu_s ...
    alt_h_ca_Fin_eu_f alt_h_ca_Fin_ch_d alt_h_ca_Fin_ch_s alt_h_ca_Fin_ch_f...
    alt_h_in_Fin_us alt_h_in_Fin_in alt_h_in_Fin_eu alt_h_in_Fin_ca alt_h_in_Fin_ch...
    alt_h_ch_Fin_us alt_h_ch_Fin_in alt_h_ch_Fin_eu alt_h_ch_Fin_ca alt_h_ch_Fin_ch...
    alt_h_ot_Fin_ot...
    p_us_Fin p_in_Fin p_eu_Fin p_ca_Fin p_ch_Fin p_ot_Fin];

supply=[h_us_IT_us_d h_us_IT_us_f h_us_IT_in_d h_us_IT_in_s h_us_IT_in_f h_us_IT_eu_d h_us_IT_eu_s h_us_IT_eu_f h_us_IT_ca_d h_us_IT_ca_s ...
    h_us_IT_ca_f h_us_IT_ch_d h_us_IT_ch_s h_us_IT_ch_f h_us_Man_us_d h_us_Man_us_f h_us_Man_in_d h_us_Man_in_s h_us_Man_in_f ...
    h_us_Man_eu_d h_us_Man_eu_s h_us_Man_eu_f h_us_Man_ca_d h_us_Man_ca_s h_us_Man_ca_f h_us_Man_ch_d h_us_Man_ch_s h_us_Man_ch_f ...
    h_us_Oth_us_d h_us_Oth_us_f h_eu_IT_eu_d h_eu_IT_eu_f h_eu_IT_in_d h_eu_IT_in_s h_eu_IT_in_f h_eu_IT_us_d h_eu_IT_us_s ...
    h_eu_IT_us_f h_eu_IT_ca_d h_eu_IT_ca_s h_eu_IT_ca_f h_eu_IT_ch_d h_eu_IT_ch_s h_eu_IT_ch_f h_eu_Man_eu_d h_eu_Man_eu_f ...
    h_eu_Man_in_d h_eu_Man_in_s h_eu_Man_in_f h_eu_Man_us_d h_eu_Man_us_s h_eu_Man_us_f h_eu_Man_ca_d h_eu_Man_ca_s h_eu_Man_ca_f ...
    h_eu_Man_ch_d h_eu_Man_ch_s h_eu_Man_ch_f h_eu_Oth_eu_d h_eu_Oth_eu_f h_ca_IT_ca_d h_ca_IT_ca_f h_ca_IT_in_d h_ca_IT_in_s h_ca_IT_in_f ...
    h_ca_IT_us_d h_ca_IT_us_s h_ca_IT_us_f h_ca_IT_eu_d h_ca_IT_eu_s h_ca_IT_eu_f h_ca_IT_ch_d h_ca_IT_ch_s h_ca_IT_ch_f h_ca_Man_ca_d ...
    h_ca_Man_ca_f h_ca_Man_in_d h_ca_Man_in_s h_ca_Man_in_f h_ca_Man_us_d h_ca_Man_us_s h_ca_Man_us_f h_ca_Man_eu_d h_ca_Man_eu_s ...
    h_ca_Man_eu_f h_ca_Man_ch_d h_ca_Man_ch_s h_ca_Man_ch_f h_ca_Oth_ca_d h_ca_Oth_ca_f h_in_IT_us h_in_IT_in h_in_IT_eu h_in_IT_ca ...
    h_in_IT_ch h_in_Man_us h_in_Man_in h_in_Man_eu h_in_Man_ca h_in_Man_ch h_in_Oth_in h_ch_IT_us h_ch_IT_in h_ch_IT_eu h_ch_IT_ca ...
    h_ch_IT_ch h_ch_Man_us h_ch_Man_in h_ch_Man_eu h_ch_Man_ca h_ch_Man_ch h_ch_Oth_ch h_ot_IT_ot h_ot_Man_ot h_ot_Oth_ot ...
    L_us L_in L_eu L_ca L_ch L_ot p_us_IT_alt p_us_Man_alt p_us_Oth_alt p_in_IT_alt p_in_Man_alt p_in_Oth_alt p_eu_IT_alt p_eu_Man_alt p_eu_Oth_alt p_ca_IT_alt p_ca_Man_alt...
    p_ca_Oth_alt p_ch_IT_alt p_ch_Man_alt p_ch_Oth_alt p_ot_IT_alt p_ot_Man_alt p_ot_Oth_alt...
    h_us_Fin_us_d h_us_Fin_us_f h_us_Fin_in_d h_us_Fin_in_s h_us_Fin_in_f ...
    h_us_Fin_eu_d h_us_Fin_eu_s h_us_Fin_eu_f h_us_Fin_ca_d h_us_Fin_ca_s h_us_Fin_ca_f h_us_Fin_ch_d h_us_Fin_ch_s h_us_Fin_ch_f ...
    h_eu_Fin_eu_d h_eu_Fin_eu_f ...
    h_eu_Fin_in_d h_eu_Fin_in_s h_eu_Fin_in_f h_eu_Fin_us_d h_eu_Fin_us_s h_eu_Fin_us_f h_eu_Fin_ca_d h_eu_Fin_ca_s h_eu_Fin_ca_f ...
    h_eu_Fin_ch_d h_eu_Fin_ch_s h_eu_Fin_ch_f...
    h_ca_Fin_ca_d ...
    h_ca_Fin_ca_f h_ca_Fin_in_d h_ca_Fin_in_s h_ca_Fin_in_f h_ca_Fin_us_d h_ca_Fin_us_s h_ca_Fin_us_f h_ca_Fin_eu_d h_ca_Fin_eu_s ...
    h_ca_Fin_eu_f h_ca_Fin_ch_d h_ca_Fin_ch_s h_ca_Fin_ch_f...
    h_in_Fin_us h_in_Fin_in h_in_Fin_eu h_in_Fin_ca h_in_Fin_ch...
    h_ch_Fin_us h_ch_Fin_in h_ch_Fin_eu h_ch_Fin_ca h_ch_Fin_ch...
    h_ot_Fin_ot...
    p_us_Fin_alt p_in_Fin_alt p_eu_Fin_alt p_ca_Fin_alt p_ch_Fin_alt p_ot_Fin_alt];




diff=demand-supply;



wage=zeros(1,139);

%Adjust initial guess of wages to get closer to demand=supply
wage(1,1)=w_us_IT_us_d+ajust*w_us_IT_us_d*(alt_h_us_IT_us_d-h_us_IT_us_d)/(alt_h_us_IT_us_d+h_us_IT_us_d);
wage(1,2)=w_us_IT_us_f+ajust*w_us_IT_us_f*(alt_h_us_IT_us_f-h_us_IT_us_f)/(alt_h_us_IT_us_f+h_us_IT_us_f);
wage(1,3)=w_us_Man_us_d+ajust*w_us_Man_us_d*(alt_h_us_Man_us_d-h_us_Man_us_d)/(alt_h_us_Man_us_d+h_us_Man_us_d);
wage(1,4)=w_us_Man_us_f+ajust*w_us_Man_us_f*(alt_h_us_Man_us_f-h_us_Man_us_f)/(alt_h_us_Man_us_f+h_us_Man_us_f);
wage(1,5)=w_us_Oth_us_d+ajust*w_us_Oth_us_d*(alt_h_us_Oth_us_d-h_us_Oth_us_d)/(alt_h_us_Oth_us_d+h_us_Oth_us_d);
wage(1,6)=w_us_Oth_us_f+ajust*w_us_Oth_us_f*(alt_h_us_Oth_us_f-h_us_Oth_us_f)/(alt_h_us_Oth_us_f+h_us_Oth_us_f);
wage(1,7)=w_us_IT_eu_d+ajust*w_us_IT_eu_d*(alt_h_us_IT_eu_d-h_us_IT_eu_d)/(alt_h_us_IT_eu_d+h_us_IT_eu_d);
wage(1,8)=w_us_IT_eu_s+ajust*w_us_IT_eu_s*(alt_h_us_IT_eu_s-h_us_IT_eu_s)/(alt_h_us_IT_eu_s+h_us_IT_eu_s);
wage(1,9)=w_us_IT_eu_f+ajust*w_us_IT_eu_f*(alt_h_us_IT_eu_f-h_us_IT_eu_f)/(alt_h_us_IT_eu_f+h_us_IT_eu_f);
wage(1,10)=w_us_Man_eu_d+ajust*w_us_Man_eu_d*(alt_h_us_Man_eu_d-h_us_Man_eu_d)/(alt_h_us_Man_eu_d+h_us_Man_eu_d);
wage(1,11)=w_us_Man_eu_s+ajust*w_us_Man_eu_s*(alt_h_us_Man_eu_s-h_us_Man_eu_s)/(alt_h_us_Man_eu_s+h_us_Man_eu_s);
wage(1,12)=w_us_Man_eu_f+ajust*w_us_Man_eu_f*(alt_h_us_Man_eu_f-h_us_Man_eu_f)/(alt_h_us_Man_eu_f+h_us_Man_eu_f);
wage(1,13)=w_us_IT_ca_d+ajust*w_us_IT_ca_d*(alt_h_us_IT_ca_d-h_us_IT_ca_d)/(alt_h_us_IT_ca_d+h_us_IT_ca_d);
wage(1,14)=w_us_IT_ca_s+ajust*w_us_IT_ca_s*(alt_h_us_IT_ca_s-h_us_IT_ca_s)/(alt_h_us_IT_ca_s+h_us_IT_ca_s);
wage(1,15)=w_us_IT_ca_f+ajust*w_us_IT_ca_f*(alt_h_us_IT_ca_f-h_us_IT_ca_f)/(alt_h_us_IT_ca_f+h_us_IT_ca_f);
wage(1,16)=w_us_Man_ca_d+ajust*w_us_Man_ca_d*(alt_h_us_Man_ca_d-h_us_Man_ca_d)/(alt_h_us_Man_ca_d+h_us_Man_ca_d);
wage(1,17)=w_us_Man_ca_s+ajust*w_us_Man_ca_s*(alt_h_us_Man_ca_s-h_us_Man_ca_s)/(alt_h_us_Man_ca_s+h_us_Man_ca_s);
wage(1,18)=w_us_Man_ca_f+ajust*w_us_Man_ca_f*(alt_h_us_Man_ca_f-h_us_Man_ca_f)/(alt_h_us_Man_ca_f+h_us_Man_ca_f);
wage(1,19)=w_us_IT_in_d+ajust*w_us_IT_in_d*(alt_h_us_IT_in_d-h_us_IT_in_d)/(alt_h_us_IT_in_d+h_us_IT_in_d);
wage(1,20)=w_us_IT_in_s+ajust*w_us_IT_in_s*(alt_h_us_IT_in_s-h_us_IT_in_s)/(alt_h_us_IT_in_s+h_us_IT_in_s);
wage(1,21)=w_us_IT_in_f+ajust*w_us_IT_in_f*(alt_h_us_IT_in_f-h_us_IT_in_f)/(alt_h_us_IT_in_f+h_us_IT_in_f);
wage(1,22)=w_us_Man_in_d+ajust*w_us_Man_in_d*(alt_h_us_Man_in_d-h_us_Man_in_d)/(alt_h_us_Man_in_d+h_us_Man_in_d);
wage(1,23)=w_us_Man_in_s+ajust*w_us_Man_in_s*(alt_h_us_Man_in_s-h_us_Man_in_s)/(alt_h_us_Man_in_s+h_us_Man_in_s);
wage(1,24)=w_us_Man_in_f+ajust*w_us_Man_in_f*(alt_h_us_Man_in_f-h_us_Man_in_f)/(alt_h_us_Man_in_f+h_us_Man_in_f);
wage(1,25)=w_us_IT_ch_d+ajust*w_us_IT_ch_d*(alt_h_us_IT_ch_d-h_us_IT_ch_d)/(alt_h_us_IT_ch_d+h_us_IT_ch_d);
wage(1,26)=w_us_IT_ch_s+ajust*w_us_IT_ch_s*(alt_h_us_IT_ch_s-h_us_IT_ch_s)/(alt_h_us_IT_ch_s+h_us_IT_ch_s);
wage(1,27)=w_us_IT_ch_f+ajust*w_us_IT_ch_f*(alt_h_us_IT_ch_f-h_us_IT_ch_f)/(alt_h_us_IT_ch_f+h_us_IT_ch_f);
wage(1,28)=w_us_Man_ch_d+ajust*w_us_Man_ch_d*(alt_h_us_Man_ch_d-h_us_Man_ch_d)/(alt_h_us_Man_ch_d+h_us_Man_ch_d);
wage(1,29)=w_us_Man_ch_s+ajust*w_us_Man_ch_s*(alt_h_us_Man_ch_s-h_us_Man_ch_s)/(alt_h_us_Man_ch_s+h_us_Man_ch_s);
wage(1,30)=w_us_Man_ch_f+ajust*w_us_Man_ch_f*(alt_h_us_Man_ch_f-h_us_Man_ch_f)/(alt_h_us_Man_ch_f+h_us_Man_ch_f);
wage(1,31)=w_eu_IT_eu_d+ajust*w_eu_IT_eu_d*(alt_h_eu_IT_eu_d-h_eu_IT_eu_d)/(alt_h_eu_IT_eu_d+h_eu_IT_eu_d);
wage(1,32)=w_eu_IT_eu_f+ajust*w_eu_IT_eu_f*(alt_h_eu_IT_eu_f-h_eu_IT_eu_f)/(alt_h_eu_IT_eu_f+h_eu_IT_eu_f);
wage(1,33)=w_eu_Man_eu_d+ajust*w_eu_Man_eu_d*(alt_h_eu_Man_eu_d-h_eu_Man_eu_d)/(alt_h_eu_Man_eu_d+h_eu_Man_eu_d);
wage(1,34)=w_eu_Man_eu_f+ajust*w_eu_Man_eu_f*(alt_h_eu_Man_eu_f-h_eu_Man_eu_f)/(alt_h_eu_Man_eu_f+h_eu_Man_eu_f);
wage(1,35)=w_eu_Oth_eu_d+ajust*w_eu_Oth_eu_d*(alt_h_eu_Oth_eu_d-h_eu_Oth_eu_d)/(alt_h_eu_Oth_eu_d+h_eu_Oth_eu_d);
wage(1,36)=w_eu_Oth_eu_f+ajust*w_eu_Oth_eu_f*(alt_h_eu_Oth_eu_f-h_eu_Oth_eu_f)/(alt_h_eu_Oth_eu_f+h_eu_Oth_eu_f);
wage(1,37)=w_eu_IT_us_d+ajust*w_eu_IT_us_d*(alt_h_eu_IT_us_d-h_eu_IT_us_d)/(alt_h_eu_IT_us_d+h_eu_IT_us_d);
wage(1,38)=w_eu_IT_us_s+ajust*w_eu_IT_us_s*(alt_h_eu_IT_us_s-h_eu_IT_us_s)/(alt_h_eu_IT_us_s+h_eu_IT_us_s);
wage(1,39)=w_eu_IT_us_f+ajust*w_eu_IT_us_f*(alt_h_eu_IT_us_f-h_eu_IT_us_f)/(alt_h_eu_IT_us_f+h_eu_IT_us_f);
wage(1,40)=w_eu_Man_us_d+ajust*w_eu_Man_us_d*(alt_h_eu_Man_us_d-h_eu_Man_us_d)/(alt_h_eu_Man_us_d+h_eu_Man_us_d);
wage(1,41)=w_eu_Man_us_s+ajust*w_eu_Man_us_s*(alt_h_eu_Man_us_s-h_eu_Man_us_s)/(alt_h_eu_Man_us_s+h_eu_Man_us_s);
wage(1,42)=w_eu_Man_us_f+ajust*w_eu_Man_us_f*(alt_h_eu_Man_us_f-h_eu_Man_us_f)/(alt_h_eu_Man_us_f+h_eu_Man_us_f);
wage(1,43)=w_eu_IT_ca_d+ajust*w_eu_IT_ca_d*(alt_h_eu_IT_ca_d-h_eu_IT_ca_d)/(alt_h_eu_IT_ca_d+h_eu_IT_ca_d);
wage(1,44)=w_eu_IT_ca_s+ajust*w_eu_IT_ca_s*(alt_h_eu_IT_ca_s-h_eu_IT_ca_s)/(alt_h_eu_IT_ca_s+h_eu_IT_ca_s);
wage(1,45)=w_eu_IT_ca_f+ajust*w_eu_IT_ca_f*(alt_h_eu_IT_ca_f-h_eu_IT_ca_f)/(alt_h_eu_IT_ca_f+h_eu_IT_ca_f);
wage(1,46)=w_eu_Man_ca_d+ajust*w_eu_Man_ca_d*(alt_h_eu_Man_ca_d-h_eu_Man_ca_d)/(alt_h_eu_Man_ca_d+h_eu_Man_ca_d);
wage(1,47)=w_eu_Man_ca_s+ajust*w_eu_Man_ca_s*(alt_h_eu_Man_ca_s-h_eu_Man_ca_s)/(alt_h_eu_Man_ca_s+h_eu_Man_ca_s);
wage(1,48)=w_eu_Man_ca_f+ajust*w_eu_Man_ca_f*(alt_h_eu_Man_ca_f-h_eu_Man_ca_f)/(alt_h_eu_Man_ca_f+h_eu_Man_ca_f);
wage(1,49)=w_eu_IT_in_d+ajust*w_eu_IT_in_d*(alt_h_eu_IT_in_d-h_eu_IT_in_d)/(alt_h_eu_IT_in_d+h_eu_IT_in_d);
wage(1,50)=w_eu_IT_in_s+ajust*w_eu_IT_in_s*(alt_h_eu_IT_in_s-h_eu_IT_in_s)/(alt_h_eu_IT_in_s+h_eu_IT_in_s);
wage(1,51)=w_eu_IT_in_f+ajust*w_eu_IT_in_f*(alt_h_eu_IT_in_f-h_eu_IT_in_f)/(alt_h_eu_IT_in_f+h_eu_IT_in_f);
wage(1,52)=w_eu_Man_in_d+ajust*w_eu_Man_in_d*(alt_h_eu_Man_in_d-h_eu_Man_in_d)/(alt_h_eu_Man_in_d+h_eu_Man_in_d);
wage(1,53)=w_eu_Man_in_s+ajust*w_eu_Man_in_s*(alt_h_eu_Man_in_s-h_eu_Man_in_s)/(alt_h_eu_Man_in_s+h_eu_Man_in_s);
wage(1,54)=w_eu_Man_in_f+ajust*w_eu_Man_in_f*(alt_h_eu_Man_in_f-h_eu_Man_in_f)/(alt_h_eu_Man_in_f+h_eu_Man_in_f);
wage(1,55)=w_eu_IT_ch_d+ajust*w_eu_IT_ch_d*(alt_h_eu_IT_ch_d-h_eu_IT_ch_d)/(alt_h_eu_IT_ch_d+h_eu_IT_ch_d);
wage(1,56)=w_eu_IT_ch_s+ajust*w_eu_IT_ch_s*(alt_h_eu_IT_ch_s-h_eu_IT_ch_s)/(alt_h_eu_IT_ch_s+h_eu_IT_ch_s);
wage(1,57)=w_eu_IT_ch_f+ajust*w_eu_IT_ch_f*(alt_h_eu_IT_ch_f-h_eu_IT_ch_f)/(alt_h_eu_IT_ch_f+h_eu_IT_ch_f);
wage(1,58)=w_eu_Man_ch_d+ajust*w_eu_Man_ch_d*(alt_h_eu_Man_ch_d-h_eu_Man_ch_d)/(alt_h_eu_Man_ch_d+h_eu_Man_ch_d);
wage(1,59)=w_eu_Man_ch_s+ajust*w_eu_Man_ch_s*(alt_h_eu_Man_ch_s-h_eu_Man_ch_s)/(alt_h_eu_Man_ch_s+h_eu_Man_ch_s);
wage(1,60)=w_eu_Man_ch_f+ajust*w_eu_Man_ch_f*(alt_h_eu_Man_ch_f-h_eu_Man_ch_f)/(alt_h_eu_Man_ch_f+h_eu_Man_ch_f);
wage(1,61)=w_ca_IT_ca_d+ajust*w_ca_IT_ca_d*(alt_h_ca_IT_ca_d-h_ca_IT_ca_d)/(alt_h_ca_IT_ca_d+h_ca_IT_ca_d);
wage(1,62)=w_ca_IT_ca_f+ajust*w_ca_IT_ca_f*(alt_h_ca_IT_ca_f-h_ca_IT_ca_f)/(alt_h_ca_IT_ca_f+h_ca_IT_ca_f);
wage(1,63)=w_ca_Man_ca_d+ajust*w_ca_Man_ca_d*(alt_h_ca_Man_ca_d-h_ca_Man_ca_d)/(alt_h_ca_Man_ca_d+h_ca_Man_ca_d);
wage(1,64)=w_ca_Man_ca_f+ajust*w_ca_Man_ca_f*(alt_h_ca_Man_ca_f-h_ca_Man_ca_f)/(alt_h_ca_Man_ca_f+h_ca_Man_ca_f);
wage(1,65)=w_ca_Oth_ca_d+ajust*w_ca_Oth_ca_d*(alt_h_ca_Oth_ca_d-h_ca_Oth_ca_d)/(alt_h_ca_Oth_ca_d+h_ca_Oth_ca_d);
wage(1,66)=w_ca_Oth_ca_f+ajust*w_ca_Oth_ca_f*(alt_h_ca_Oth_ca_f-h_ca_Oth_ca_f)/(alt_h_ca_Oth_ca_f+h_ca_Oth_ca_f);
wage(1,67)=w_ca_IT_us_d+ajust*w_ca_IT_us_d*(alt_h_ca_IT_us_d-h_ca_IT_us_d)/(alt_h_ca_IT_us_d+h_ca_IT_us_d);
wage(1,68)=w_ca_IT_us_s+ajust*w_ca_IT_us_s*(alt_h_ca_IT_us_s-h_ca_IT_us_s)/(alt_h_ca_IT_us_s+h_ca_IT_us_s);
wage(1,69)=w_ca_IT_us_f+ajust*w_ca_IT_us_f*(alt_h_ca_IT_us_f-h_ca_IT_us_f)/(alt_h_ca_IT_us_f+h_ca_IT_us_f);
wage(1,70)=w_ca_Man_us_d+ajust*w_ca_Man_us_d*(alt_h_ca_Man_us_d-h_ca_Man_us_d)/(alt_h_ca_Man_us_d+h_ca_Man_us_d);
wage(1,71)=w_ca_Man_us_s+ajust*w_ca_Man_us_s*(alt_h_ca_Man_us_s-h_ca_Man_us_s)/(alt_h_ca_Man_us_s+h_ca_Man_us_s);
wage(1,72)=w_ca_Man_us_f+ajust*w_ca_Man_us_f*(alt_h_ca_Man_us_f-h_ca_Man_us_f)/(alt_h_ca_Man_us_f+h_ca_Man_us_f);
wage(1,73)=w_ca_IT_eu_d+ajust*w_ca_IT_eu_d*(alt_h_ca_IT_eu_d-h_ca_IT_eu_d)/(alt_h_ca_IT_eu_d+h_ca_IT_eu_d);
wage(1,74)=w_ca_IT_eu_s+ajust*w_ca_IT_eu_s*(alt_h_ca_IT_eu_s-h_ca_IT_eu_s)/(alt_h_ca_IT_eu_s+h_ca_IT_eu_s);
wage(1,75)=w_ca_IT_eu_f+ajust*w_ca_IT_eu_f*(alt_h_ca_IT_eu_f-h_ca_IT_eu_f)/(alt_h_ca_IT_eu_f+h_ca_IT_eu_f);
wage(1,76)=w_ca_Man_eu_d+ajust*w_ca_Man_eu_d*(alt_h_ca_Man_eu_d-h_ca_Man_eu_d)/(alt_h_ca_Man_eu_d+h_ca_Man_eu_d);
wage(1,77)=w_ca_Man_eu_s+ajust*w_ca_Man_eu_s*(alt_h_ca_Man_eu_s-h_ca_Man_eu_s)/(alt_h_ca_Man_eu_s+h_ca_Man_eu_s);
wage(1,78)=w_ca_Man_eu_f+ajust*w_ca_Man_eu_f*(alt_h_ca_Man_eu_f-h_ca_Man_eu_f)/(alt_h_ca_Man_eu_f+h_ca_Man_eu_f);
wage(1,79)=w_ca_IT_in_d+ajust*w_ca_IT_in_d*(alt_h_ca_IT_in_d-h_ca_IT_in_d)/(alt_h_ca_IT_in_d+h_ca_IT_in_d);
wage(1,80)=w_ca_IT_in_s+ajust*w_ca_IT_in_s*(alt_h_ca_IT_in_s-h_ca_IT_in_s)/(alt_h_ca_IT_in_s+h_ca_IT_in_s);
wage(1,81)=w_ca_IT_in_f+ajust*w_ca_IT_in_f*(alt_h_ca_IT_in_f-h_ca_IT_in_f)/(alt_h_ca_IT_in_f+h_ca_IT_in_f);
wage(1,82)=w_ca_Man_in_d+ajust*w_ca_Man_in_d*(alt_h_ca_Man_in_d-h_ca_Man_in_d)/(alt_h_ca_Man_in_d+h_ca_Man_in_d);
wage(1,83)=w_ca_Man_in_s+ajust*w_ca_Man_in_s*(alt_h_ca_Man_in_s-h_ca_Man_in_s)/(alt_h_ca_Man_in_s+h_ca_Man_in_s);
wage(1,84)=w_ca_Man_in_f+ajust*w_ca_Man_in_f*(alt_h_ca_Man_in_f-h_ca_Man_in_f)/(alt_h_ca_Man_in_f+h_ca_Man_in_f);
wage(1,85)=w_ca_IT_ch_d+ajust*w_ca_IT_ch_d*(alt_h_ca_IT_ch_d-h_ca_IT_ch_d)/(alt_h_ca_IT_ch_d+h_ca_IT_ch_d);
wage(1,86)=w_ca_IT_ch_s+ajust*w_ca_IT_ch_s*(alt_h_ca_IT_ch_s-h_ca_IT_ch_s)/(alt_h_ca_IT_ch_s+h_ca_IT_ch_s);
wage(1,87)=w_ca_IT_ch_f+ajust*w_ca_IT_ch_f*(alt_h_ca_IT_ch_f-h_ca_IT_ch_f)/(alt_h_ca_IT_ch_f+h_ca_IT_ch_f);
wage(1,88)=w_ca_Man_ch_d+ajust*w_ca_Man_ch_d*(alt_h_ca_Man_ch_d-h_ca_Man_ch_d)/(alt_h_ca_Man_ch_d+h_ca_Man_ch_d);
wage(1,89)=w_ca_Man_ch_s+ajust*w_ca_Man_ch_s*(alt_h_ca_Man_ch_s-h_ca_Man_ch_s)/(alt_h_ca_Man_ch_s+h_ca_Man_ch_s);
wage(1,90)=w_ca_Man_ch_f+ajust*w_ca_Man_ch_f*(alt_h_ca_Man_ch_f-h_ca_Man_ch_f)/(alt_h_ca_Man_ch_f+h_ca_Man_ch_f);
wage(1,91)=w_in_IT_us+ajust*w_in_IT_us*(alt_h_in_IT_us-h_in_IT_us)/(alt_h_in_IT_us+h_in_IT_us);
wage(1,92)=w_in_IT_in+ajust*w_in_IT_in*(alt_h_in_IT_in-h_in_IT_in)/(alt_h_in_IT_in+h_in_IT_in);
wage(1,93)=w_in_IT_eu+ajust*w_in_IT_eu*(alt_h_in_IT_eu-h_in_IT_eu)/(alt_h_in_IT_eu+h_in_IT_eu);
wage(1,94)=w_in_IT_ca+ajust*w_in_IT_ca*(alt_h_in_IT_ca-h_in_IT_ca)/(alt_h_in_IT_ca+h_in_IT_ca);
wage(1,95)=w_in_IT_ch+ajust*w_in_IT_ch*(alt_h_in_IT_ch-h_in_IT_ch)/(alt_h_in_IT_ch+h_in_IT_ch);
wage(1,96)=w_in_Man_us+ajust*w_in_Man_us*(alt_h_in_Man_us-h_in_Man_us)/(alt_h_in_Man_us+h_in_Man_us);
wage(1,97)=w_in_Man_in+ajust*w_in_Man_in*(alt_h_in_Man_in-h_in_Man_in)/(alt_h_in_Man_in+h_in_Man_in);
wage(1,98)=w_in_Man_eu+ajust*w_in_Man_eu*(alt_h_in_Man_eu-h_in_Man_eu)/(alt_h_in_Man_eu+h_in_Man_eu);
wage(1,99)=w_in_Man_ca+ajust*w_in_Man_ca*(alt_h_in_Man_ca-h_in_Man_ca)/(alt_h_in_Man_ca+h_in_Man_ca);
wage(1,100)=w_in_Man_ch+ajust*w_in_Man_ch*(alt_h_in_Man_ch-h_in_Man_ch)/(alt_h_in_Man_ch+h_in_Man_ch);
wage(1,101)=w_in_Oth_in+ajust*w_in_Oth_in*(alt_h_in_Oth_in-h_in_Oth_in)/(alt_h_in_Oth_in+h_in_Oth_in);
wage(1,102)=w_ch_IT_us+ajust*w_ch_IT_us*(alt_h_ch_IT_us-h_ch_IT_us)/(alt_h_ch_IT_us+h_ch_IT_us);
wage(1,103)=w_ch_IT_in+ajust*w_ch_IT_in*(alt_h_ch_IT_in-h_ch_IT_in)/(alt_h_ch_IT_in+h_ch_IT_in);
wage(1,104)=w_ch_IT_eu+ajust*w_ch_IT_eu*(alt_h_ch_IT_eu-h_ch_IT_eu)/(alt_h_ch_IT_eu+h_ch_IT_eu);
wage(1,105)=w_ch_IT_ca+ajust*w_ch_IT_ca*(alt_h_ch_IT_ca-h_ch_IT_ca)/(alt_h_ch_IT_ca+h_ch_IT_ca);
wage(1,106)=w_ch_IT_ch+ajust*w_ch_IT_ch*(alt_h_ch_IT_ch-h_ch_IT_ch)/(alt_h_ch_IT_ch+h_ch_IT_ch);
wage(1,107)=w_ch_Man_us+ajust*w_ch_Man_us*(alt_h_ch_Man_us-h_ch_Man_us)/(alt_h_ch_Man_us+h_ch_Man_us);
wage(1,108)=w_ch_Man_in+ajust*w_ch_Man_in*(alt_h_ch_Man_in-h_ch_Man_in)/(alt_h_ch_Man_in+h_ch_Man_in);
wage(1,109)=w_ch_Man_eu+ajust*w_ch_Man_eu*(alt_h_ch_Man_eu-h_ch_Man_eu)/(alt_h_ch_Man_eu+h_ch_Man_eu);
wage(1,110)=w_ch_Man_ca+ajust*w_ch_Man_ca*(alt_h_ch_Man_ca-h_ch_Man_ca)/(alt_h_ch_Man_ca+h_ch_Man_ca);
wage(1,111)=w_ch_Man_ch+ajust*w_ch_Man_ch*(alt_h_ch_Man_ch-h_ch_Man_ch)/(alt_h_ch_Man_ch+h_ch_Man_ch);
wage(1,112)=w_ch_Oth_ch+ajust*w_ch_Oth_ch*(alt_h_ch_Oth_ch-h_ch_Oth_ch)/(alt_h_ch_Oth_ch+h_ch_Oth_ch);
wage(1,113)=w_ot_IT_ot+ajust*w_ot_IT_ot*(alt_h_ot_IT_ot-h_ot_IT_ot)/(alt_h_ot_IT_ot+h_ot_IT_ot);
wage(1,114)=w_ot_Man_ot+ajust*w_ot_Man_ot*(alt_h_ot_Man_ot-h_ot_Man_ot)/(alt_h_ot_Man_ot+h_ot_Man_ot);
wage(1,115)=w_ot_Oth_ot+ajust*w_ot_Oth_ot*(alt_h_ot_Oth_ot-h_ot_Oth_ot)/(alt_h_ot_Oth_ot+h_ot_Oth_ot);
wage(1,116)=w_us_L+ajust*w_us_L*(alt_L_us-L_us)/(alt_L_us+L_us);
wage(1,117)=w_in_L+ajust*w_in_L*(alt_L_in-L_in)/(alt_L_in+L_in);
wage(1,118)=w_eu_L+ajust*w_eu_L*(alt_L_eu-L_eu)/(alt_L_eu+L_eu);
wage(1,119)=w_ca_L+ajust*w_ca_L*(alt_L_ca-L_ca)/(alt_L_ca+L_ca);
wage(1,120)=w_ch_L+ajust*w_ch_L*(alt_L_ch-L_ch)/(alt_L_ch+L_ch);
wage(1,121)=w_ot_L+ajust*w_ot_L*(alt_L_ot-L_ot)/(alt_L_ot+L_ot);

wage(1,122)=p_us_IT_alt+ajust*p_us_IT_alt*(p_us_IT-p_us_IT_alt)/(p_us_IT+p_us_IT_alt); 
wage(1,123)=p_us_Man_alt+ajust*p_us_Man_alt*(p_us_Man-p_us_Man_alt)/(p_us_Man+p_us_Man_alt); 
wage(1,124)=p_us_Oth_alt+ajust*p_us_Oth_alt*(p_us_Oth-p_us_Oth_alt)/(p_us_Oth+p_us_Oth_alt); 
wage(1,125)=p_in_IT_alt+ajust*p_in_IT_alt*(p_in_IT-p_in_IT_alt)/(p_in_IT+p_in_IT_alt); 
wage(1,126)=p_in_Man_alt+ajust*p_in_Man_alt*(p_in_Man-p_in_Man_alt)/(p_in_Man+p_in_Man_alt); 
wage(1,127)=p_in_Oth_alt+ajust*p_in_Oth_alt*(p_in_Oth-p_in_Oth_alt)/(p_in_Oth+p_in_Oth_alt); 
wage(1,128)=p_eu_IT_alt+ajust*p_eu_IT_alt*(p_eu_IT-p_eu_IT_alt)/(p_eu_IT+p_eu_IT_alt); 
wage(1,129)=p_eu_Man_alt+ajust*p_eu_Man_alt*(p_eu_Man-p_eu_Man_alt)/(p_eu_Man+p_eu_Man_alt); 
wage(1,130)=p_eu_Oth_alt+ajust*p_eu_Oth_alt*(p_eu_Oth-p_eu_Oth_alt)/(p_eu_Oth+p_eu_Oth_alt); 
wage(1,131)=p_ca_IT_alt+ajust*p_ca_IT_alt*(p_ca_IT-p_ca_IT_alt)/(p_ca_IT+p_ca_IT_alt); 
wage(1,132)=p_ca_Man_alt+ajust*p_ca_Man_alt*(p_ca_Man-p_ca_Man_alt)/(p_ca_Man+p_ca_Man_alt); 
wage(1,133)=p_ca_Oth_alt+ajust*p_ca_Oth_alt*(p_ca_Oth-p_ca_Oth_alt)/(p_ca_Oth+p_ca_Oth_alt); 
wage(1,134)=p_ch_IT_alt+ajust*p_ch_IT_alt*(p_ch_IT-p_ch_IT_alt)/(p_ch_IT+p_ch_IT_alt); 
wage(1,135)=p_ch_Man_alt+ajust*p_ch_Man_alt*(p_ch_Man-p_ch_Man_alt)/(p_ch_Man_alt+p_ch_Man_alt); 
wage(1,136)=p_ch_Oth_alt+ajust*p_ch_Oth_alt*(p_ch_Oth-p_ch_Oth_alt)/(p_ch_Oth_alt+p_ch_Oth_alt); 
wage(1,137)=p_ot_IT_alt+ajust*p_ot_IT_alt*(p_ot_IT-p_ot_IT_alt)/(p_ot_IT_alt+p_ot_IT_alt); 
wage(1,138)=p_ot_Man_alt+ajust*p_ot_Man_alt*(p_ot_Man-p_ot_Man_alt)/(p_ot_Man_alt+p_ot_Man_alt); 
wage(1,139)=p_ot_Oth_alt+ajust*p_ot_Oth_alt*(p_ot_Oth-p_ot_Oth_alt)/(p_ot_Oth_alt+p_ot_Oth_alt);


wage(1,140)=w_us_Fin_us_d+ajust*w_us_Fin_us_d*(alt_h_us_Fin_us_d-h_us_Fin_us_d)/(alt_h_us_Fin_us_d+h_us_Fin_us_d);
wage(1,141)=w_us_Fin_us_f+ajust*w_us_Fin_us_f*(alt_h_us_Fin_us_f-h_us_Fin_us_f)/(alt_h_us_Fin_us_f+h_us_Fin_us_f);
wage(1,142)=w_us_Fin_eu_d+ajust*w_us_Fin_eu_d*(alt_h_us_Fin_eu_d-h_us_Fin_eu_d)/(alt_h_us_Fin_eu_d+h_us_Fin_eu_d);
wage(1,143)=w_us_Fin_eu_s+ajust*w_us_Fin_eu_s*(alt_h_us_Fin_eu_s-h_us_Fin_eu_s)/(alt_h_us_Fin_eu_s+h_us_Fin_eu_s);
wage(1,144)=w_us_Fin_eu_f+ajust*w_us_Fin_eu_f*(alt_h_us_Fin_eu_f-h_us_Fin_eu_f)/(alt_h_us_Fin_eu_f+h_us_Fin_eu_f);
wage(1,145)=w_us_Fin_ca_d+ajust*w_us_Fin_ca_d*(alt_h_us_Fin_ca_d-h_us_Fin_ca_d)/(alt_h_us_Fin_ca_d+h_us_Fin_ca_d);
wage(1,146)=w_us_Fin_ca_s+ajust*w_us_Fin_ca_s*(alt_h_us_Fin_ca_s-h_us_Fin_ca_s)/(alt_h_us_Fin_ca_s+h_us_Fin_ca_s);
wage(1,147)=w_us_Fin_ca_f+ajust*w_us_Fin_ca_f*(alt_h_us_Fin_ca_f-h_us_Fin_ca_f)/(alt_h_us_Fin_ca_f+h_us_Fin_ca_f);
wage(1,148)=w_us_Fin_in_d+ajust*w_us_Fin_in_d*(alt_h_us_Fin_in_d-h_us_Fin_in_d)/(alt_h_us_Fin_in_d+h_us_Fin_in_d);
wage(1,149)=w_us_Fin_in_s+ajust*w_us_Fin_in_s*(alt_h_us_Fin_in_s-h_us_Fin_in_s)/(alt_h_us_Fin_in_s+h_us_Fin_in_s);
wage(1,150)=w_us_Fin_in_f+ajust*w_us_Fin_in_f*(alt_h_us_Fin_in_f-h_us_Fin_in_f)/(alt_h_us_Fin_in_f+h_us_Fin_in_f);
wage(1,151)=w_us_Fin_ch_d+ajust*w_us_Fin_ch_d*(alt_h_us_Fin_ch_d-h_us_Fin_ch_d)/(alt_h_us_Fin_ch_d+h_us_Fin_ch_d);
wage(1,152)=w_us_Fin_ch_s+ajust*w_us_Fin_ch_s*(alt_h_us_Fin_ch_s-h_us_Fin_ch_s)/(alt_h_us_Fin_ch_s+h_us_Fin_ch_s);
wage(1,153)=w_us_Fin_ch_f+ajust*w_us_Fin_ch_f*(alt_h_us_Fin_ch_f-h_us_Fin_ch_f)/(alt_h_us_Fin_ch_f+h_us_Fin_ch_f);
wage(1,154)=w_eu_Fin_eu_d+ajust*w_eu_Fin_eu_d*(alt_h_eu_Fin_eu_d-h_eu_Fin_eu_d)/(alt_h_eu_Fin_eu_d+h_eu_Fin_eu_d);
wage(1,155)=w_eu_Fin_eu_f+ajust*w_eu_Fin_eu_f*(alt_h_eu_Fin_eu_f-h_eu_Fin_eu_f)/(alt_h_eu_Fin_eu_f+h_eu_Fin_eu_f);
wage(1,156)=w_eu_Fin_us_d+ajust*w_eu_Fin_us_d*(alt_h_eu_Fin_us_d-h_eu_Fin_us_d)/(alt_h_eu_Fin_us_d+h_eu_Fin_us_d);
wage(1,157)=w_eu_Fin_us_s+ajust*w_eu_Fin_us_s*(alt_h_eu_Fin_us_s-h_eu_Fin_us_s)/(alt_h_eu_Fin_us_s+h_eu_Fin_us_s);
wage(1,158)=w_eu_Fin_us_f+ajust*w_eu_Fin_us_f*(alt_h_eu_Fin_us_f-h_eu_Fin_us_f)/(alt_h_eu_Fin_us_f+h_eu_Fin_us_f);
wage(1,159)=w_eu_Fin_ca_d+ajust*w_eu_Fin_ca_d*(alt_h_eu_Fin_ca_d-h_eu_Fin_ca_d)/(alt_h_eu_Fin_ca_d+h_eu_Fin_ca_d);
wage(1,160)=w_eu_Fin_ca_s+ajust*w_eu_Fin_ca_s*(alt_h_eu_Fin_ca_s-h_eu_Fin_ca_s)/(alt_h_eu_Fin_ca_s+h_eu_Fin_ca_s);
wage(1,161)=w_eu_Fin_ca_f+ajust*w_eu_Fin_ca_f*(alt_h_eu_Fin_ca_f-h_eu_Fin_ca_f)/(alt_h_eu_Fin_ca_f+h_eu_Fin_ca_f);
wage(1,162)=w_eu_Fin_in_d+ajust*w_eu_Fin_in_d*(alt_h_eu_Fin_in_d-h_eu_Fin_in_d)/(alt_h_eu_Fin_in_d+h_eu_Fin_in_d);
wage(1,163)=w_eu_Fin_in_s+ajust*w_eu_Fin_in_s*(alt_h_eu_Fin_in_s-h_eu_Fin_in_s)/(alt_h_eu_Fin_in_s+h_eu_Fin_in_s);
wage(1,164)=w_eu_Fin_in_f+ajust*w_eu_Fin_in_f*(alt_h_eu_Fin_in_f-h_eu_Fin_in_f)/(alt_h_eu_Fin_in_f+h_eu_Fin_in_f);
wage(1,165)=w_eu_Fin_ch_d+ajust*w_eu_Fin_ch_d*(alt_h_eu_Fin_ch_d-h_eu_Fin_ch_d)/(alt_h_eu_Fin_ch_d+h_eu_Fin_ch_d);
wage(1,166)=w_eu_Fin_ch_s+ajust*w_eu_Fin_ch_s*(alt_h_eu_Fin_ch_s-h_eu_Fin_ch_s)/(alt_h_eu_Fin_ch_s+h_eu_Fin_ch_s);
wage(1,167)=w_eu_Fin_ch_f+ajust*w_eu_Fin_ch_f*(alt_h_eu_Fin_ch_f-h_eu_Fin_ch_f)/(alt_h_eu_Fin_ch_f+h_eu_Fin_ch_f);
wage(1,168)=w_ca_Fin_ca_d+ajust*w_ca_Fin_ca_d*(alt_h_ca_Fin_ca_d-h_ca_Fin_ca_d)/(alt_h_ca_Fin_ca_d+h_ca_Fin_ca_d);
wage(1,169)=w_ca_Fin_ca_f+ajust*w_ca_Fin_ca_f*(alt_h_ca_Fin_ca_f-h_ca_Fin_ca_f)/(alt_h_ca_Fin_ca_f+h_ca_Fin_ca_f);
wage(1,170)=w_ca_Fin_us_d+ajust*w_ca_Fin_us_d*(alt_h_ca_Fin_us_d-h_ca_Fin_us_d)/(alt_h_ca_Fin_us_d+h_ca_Fin_us_d);
wage(1,171)=w_ca_Fin_us_s+ajust*w_ca_Fin_us_s*(alt_h_ca_Fin_us_s-h_ca_Fin_us_s)/(alt_h_ca_Fin_us_s+h_ca_Fin_us_s);
wage(1,172)=w_ca_Fin_us_f+ajust*w_ca_Fin_us_f*(alt_h_ca_Fin_us_f-h_ca_Fin_us_f)/(alt_h_ca_Fin_us_f+h_ca_Fin_us_f);
wage(1,173)=w_ca_Fin_eu_d+ajust*w_ca_Fin_eu_d*(alt_h_ca_Fin_eu_d-h_ca_Fin_eu_d)/(alt_h_ca_Fin_eu_d+h_ca_Fin_eu_d);
wage(1,174)=w_ca_Fin_eu_s+ajust*w_ca_Fin_eu_s*(alt_h_ca_Fin_eu_s-h_ca_Fin_eu_s)/(alt_h_ca_Fin_eu_s+h_ca_Fin_eu_s);
wage(1,175)=w_ca_Fin_eu_f+ajust*w_ca_Fin_eu_f*(alt_h_ca_Fin_eu_f-h_ca_Fin_eu_f)/(alt_h_ca_Fin_eu_f+h_ca_Fin_eu_f);
wage(1,176)=w_ca_Fin_in_d+ajust*w_ca_Fin_in_d*(alt_h_ca_Fin_in_d-h_ca_Fin_in_d)/(alt_h_ca_Fin_in_d+h_ca_Fin_in_d);
wage(1,177)=w_ca_Fin_in_s+ajust*w_ca_Fin_in_s*(alt_h_ca_Fin_in_s-h_ca_Fin_in_s)/(alt_h_ca_Fin_in_s+h_ca_Fin_in_s);
wage(1,178)=w_ca_Fin_in_f+ajust*w_ca_Fin_in_f*(alt_h_ca_Fin_in_f-h_ca_Fin_in_f)/(alt_h_ca_Fin_in_f+h_ca_Fin_in_f);
wage(1,179)=w_ca_Fin_ch_d+ajust*w_ca_Fin_ch_d*(alt_h_ca_Fin_ch_d-h_ca_Fin_ch_d)/(alt_h_ca_Fin_ch_d+h_ca_Fin_ch_d);
wage(1,180)=w_ca_Fin_ch_s+ajust*w_ca_Fin_ch_s*(alt_h_ca_Fin_ch_s-h_ca_Fin_ch_s)/(alt_h_ca_Fin_ch_s+h_ca_Fin_ch_s);
wage(1,181)=w_ca_Fin_ch_f+ajust*w_ca_Fin_ch_f*(alt_h_ca_Fin_ch_f-h_ca_Fin_ch_f)/(alt_h_ca_Fin_ch_f+h_ca_Fin_ch_f);
wage(1,182)=w_in_Fin_us+ajust*w_in_Fin_us*(alt_h_in_Fin_us-h_in_Fin_us)/(alt_h_in_Fin_us+h_in_Fin_us);
wage(1,183)=w_in_Fin_in+ajust*w_in_Fin_in*(alt_h_in_Fin_in-h_in_Fin_in)/(alt_h_in_Fin_in+h_in_Fin_in);
wage(1,184)=w_in_Fin_eu+ajust*w_in_Fin_eu*(alt_h_in_Fin_eu-h_in_Fin_eu)/(alt_h_in_Fin_eu+h_in_Fin_eu);
wage(1,185)=w_in_Fin_ca+ajust*w_in_Fin_ca*(alt_h_in_Fin_ca-h_in_Fin_ca)/(alt_h_in_Fin_ca+h_in_Fin_ca);
wage(1,186)=w_in_Fin_ch+ajust*w_in_Fin_ch*(alt_h_in_Fin_ch-h_in_Fin_ch)/(alt_h_in_Fin_ch+h_in_Fin_ch);
wage(1,187)=w_ch_Fin_us+ajust*w_ch_Fin_us*(alt_h_ch_Fin_us-h_ch_Fin_us)/(alt_h_ch_Fin_us+h_ch_Fin_us);
wage(1,188)=w_ch_Fin_in+ajust*w_ch_Fin_in*(alt_h_ch_Fin_in-h_ch_Fin_in)/(alt_h_ch_Fin_in+h_ch_Fin_in);
wage(1,189)=w_ch_Fin_eu+ajust*w_ch_Fin_eu*(alt_h_ch_Fin_eu-h_ch_Fin_eu)/(alt_h_ch_Fin_eu+h_ch_Fin_eu);
wage(1,190)=w_ch_Fin_ca+ajust*w_ch_Fin_ca*(alt_h_ch_Fin_ca-h_ch_Fin_ca)/(alt_h_ch_Fin_ca+h_ch_Fin_ca);
wage(1,191)=w_ch_Fin_ch+ajust*w_ch_Fin_ch*(alt_h_ch_Fin_ch-h_ch_Fin_ch)/(alt_h_ch_Fin_ch+h_ch_Fin_ch);
wage(1,192)=w_ot_Fin_ot+ajust*w_ot_Fin_ot*(alt_h_ot_Fin_ot-h_ot_Fin_ot)/(alt_h_ot_Fin_ot+h_ot_Fin_ot);
wage(1,193)=p_us_Fin_alt+ajust*p_us_Fin_alt*(p_us_Fin-p_us_Fin_alt)/(p_us_Fin+p_us_Fin_alt); 
wage(1,194)=p_in_Fin_alt+ajust*p_in_Fin_alt*(p_in_Fin-p_in_Fin_alt)/(p_in_Fin+p_in_Fin_alt); 
wage(1,195)=p_eu_Fin_alt+ajust*p_eu_Fin_alt*(p_eu_Fin-p_eu_Fin_alt)/(p_eu_Fin+p_eu_Fin_alt); 
wage(1,196)=p_ca_Fin_alt+ajust*p_ca_Fin_alt*(p_ca_Fin-p_ca_Fin_alt)/(p_ca_Fin+p_ca_Fin_alt); 
wage(1,197)=p_ch_Fin_alt+ajust*p_ch_Fin_alt*(p_ch_Fin-p_ch_Fin_alt)/(p_ch_Fin_alt+p_ch_Fin_alt); 
wage(1,198)=p_ot_Fin_alt+ajust*p_ot_Fin_alt*(p_ot_Fin-p_ot_Fin_alt)/(p_ot_Fin_alt+p_ot_Fin_alt); 


%While the difference is large, the loop continues
omega_crit=sum(abs(diff));


end

%Variables for export:

Revenues=[inc_ca_IT inc_ca_Man inc_ca_Oth inc_ch_IT inc_ch_Man inc_ch_Oth inc_eu_IT inc_eu_Man inc_eu_Oth inc_in_IT inc_in_Man inc_in_Oth inc_ot_IT inc_ot_Man inc_ot_Oth inc_us_IT inc_us_Man inc_us_Oth]';
Revenues_Fin=[inc_us_Fin inc_in_Fin inc_eu_Fin inc_ca_Fin inc_ch_Fin inc_ot_Fin]';

US_Rev_source=[mne_us_us_IT*inc_us_IT mne_us_us_Man*inc_us_Man mne_us_in_IT*inc_us_IT mne_us_in_Man*inc_us_Man mne_us_eu_IT*inc_us_IT mne_us_eu_Man*inc_us_Man mne_us_ch_IT*inc_us_IT mne_us_ch_Man*inc_us_Man mne_us_ca_IT*inc_us_IT mne_us_ca_Man*inc_us_Man]';
US_Rev_source_Fin=[mne_us_us_Fin*inc_us_Fin mne_us_in_Fin*inc_us_Fin mne_us_eu_Fin*inc_us_Fin mne_us_ch_Fin*inc_us_Fin mne_us_ca_Fin*inc_us_Fin]';

mne_shares=[mne_us_us_IT mne_us_us_Man mne_us_in_IT mne_us_in_Man mne_us_eu_IT mne_us_eu_Man mne_us_ca_IT mne_us_ca_Man mne_us_ch_IT mne_us_ch_Man]';
mne_shares_Fin=[mne_us_us_Fin mne_us_in_Fin mne_us_eu_Fin mne_us_ca_Fin mne_us_ch_Fin]';


revenues_alt_us_IT=mne_us_us_IT*inc_us_IT*MNE_shares_IT_us(1,1)+mne_us_in_IT*inc_us_IT*MNE_shares_IT_us(1,2)+mne_us_eu_IT*inc_us_IT*MNE_shares_IT_us(1,3)+mne_us_ca_IT*inc_us_IT*MNE_shares_IT_us(1,4)+mne_us_ch_IT*inc_us_IT*MNE_shares_IT_us(1,5);
revenues_alt_us_Man=mne_us_us_Man*inc_us_Man*MNE_shares_Man_us(1,1)+mne_us_in_Man*inc_us_Man*MNE_shares_Man_us(1,2)+mne_us_eu_Man*inc_us_Man*MNE_shares_Man_us(1,3)+mne_us_ca_Man*inc_us_Man*MNE_shares_Man_us(1,4)+mne_us_ch_Man*inc_us_Man*MNE_shares_Man_us(1,5);
revenues_alt_us_Fin=mne_us_us_Fin*inc_us_Fin*MNE_shares_Fin_us(1,1)+mne_us_in_Fin*inc_us_Fin*MNE_shares_Fin_us(1,2)+mne_us_eu_Fin*inc_us_Fin*MNE_shares_Fin_us(1,3)+mne_us_ca_Fin*inc_us_Fin*MNE_shares_Fin_us(1,4)+mne_us_ch_Fin*inc_us_Fin*MNE_shares_Fin_us(1,5);



%US production structure
%Calculate total income abroad or domestic

%Production shares by country

revenue_shares=[1.28E-01	8.80E-02	7.16E-01	6.85E-02...
4.05E-02	1.07E-01	8.19E-01	3.33E-02...
8.75E-02	5.98E-02	7.96E-01	5.63E-02...
4.40E-02	2.33E-01	6.97E-01	2.64E-02...
1.05E-01	1.10E-01	7.28E-01	5.63E-02...
6.32E-02	1.23E-01	7.76E-01	3.81E-02];

total_us_output=inc_us_IT*revenue_shares(1,1)+inc_us_Man*revenue_shares(1,2)+inc_us_Oth*revenue_shares(1,3)+inc_us_Fin*revenue_shares(1,4);
total_in_output=inc_in_IT*revenue_shares(1,5)+inc_in_Man*revenue_shares(1,6)+inc_in_Oth*revenue_shares(1,7)+inc_in_Fin*revenue_shares(1,8);
total_ca_output=inc_ca_IT*revenue_shares(1,9)+inc_ca_Man*revenue_shares(1,10)+inc_ca_Oth*revenue_shares(1,11)+inc_ca_Fin*revenue_shares(1,12);
total_ch_output=inc_ch_IT*revenue_shares(1,13)+inc_ch_Man*revenue_shares(1,14)+inc_ch_Oth*revenue_shares(1,15)+inc_ch_Fin*revenue_shares(1,16);
total_eu_output=inc_eu_IT*revenue_shares(1,17)+inc_eu_Man*revenue_shares(1,18)+inc_eu_Oth*revenue_shares(1,19)+inc_eu_Fin*revenue_shares(1,20);
total_ot_output=inc_ot_IT*revenue_shares(1,21)+inc_ot_Man*revenue_shares(1,22)+inc_ot_Oth*revenue_shares(1,23)+inc_ot_Fin*revenue_shares(1,24);

total_output=[total_us_output total_in_output total_eu_output total_ca_output total_ch_output total_ot_output]';

Trade_shares_us_importer=[trade_us_us_IT trade_us_us_Man trade_us_us_Oth trade_us_in_IT trade_us_in_Man trade_us_in_Oth trade_us_eu_IT trade_us_eu_Man trade_us_eu_Oth trade_us_ca_IT trade_us_ca_Man trade_us_ca_Oth trade_us_ch_IT trade_us_ch_Man trade_us_ch_Oth  trade_us_ot_IT trade_us_ot_Man trade_us_ot_Oth]';
Trade_shares_us_importer_Fin=[trade_us_us_Fin trade_us_in_Fin trade_us_eu_Fin trade_us_ca_Fin trade_us_ch_Fin trade_us_ot_Fin]';

domestic_trade=[1.29E-01	7.07E-02	7.31E-01	6.92E-02];

domestic_trade_share_us=trade_us_us_IT*domestic_trade(1,1)+trade_us_us_Man*domestic_trade(1,2)+trade_us_us_Oth*domestic_trade(1,3)+trade_us_us_Fin*domestic_trade(1,4);



%High skill employment Natives

share_emp_man_us=[0.760839365	0.000175563	0.226123575	0.012820179	4.13186E-05];
share_emp_it_us=[0.970225499	0.00019793	0.027741165	0.001804571	3.08349E-05];
share_emp_fin_us=[8.80E-01	8.86E-05	9.55E-02	2.48E-02	5.13E-05];

native_emp_IT_tot=mig_us_IT_us_us*share_emp_it_us(1,1)+mig_us_IT_us_in*share_emp_it_us(1,2)+mig_us_IT_us_eu*share_emp_it_us(1,3)+mig_us_IT_us_ca*share_emp_it_us(1,4)+mig_us_IT_us_ch*share_emp_it_us(1,5);
native_emp_Man_tot=mig_us_Man_us_us*share_emp_man_us(1,1)+mig_us_Man_us_in*share_emp_man_us(1,2)+mig_us_Man_us_eu*share_emp_man_us(1,3)+mig_us_Man_us_ca*share_emp_man_us(1,4)+mig_us_Man_us_ch*share_emp_man_us(1,5);
native_emp_Fin_tot=mig_us_Fin_us_us*share_emp_fin_us(1,1)+mig_us_Fin_us_in*share_emp_fin_us(1,2)+mig_us_Fin_us_eu*share_emp_fin_us(1,3)+mig_us_Fin_us_ca*share_emp_fin_us(1,4)+mig_us_Fin_us_ch*share_emp_fin_us(1,5);

Native_employment=[mig_us_IT_us_us mig_us_IT_us_in mig_us_IT_us_eu mig_us_IT_us_ca mig_us_IT_us_ch mig_us_Man_us_us mig_us_Man_us_in mig_us_Man_us_eu mig_us_Man_us_ca mig_us_Man_us_ch]';
Native_employment_Fin=[mig_us_Fin_us_us mig_us_Fin_us_in mig_us_Fin_us_eu mig_us_Fin_us_ca mig_us_Fin_us_ch]';

%Low skill employment

share_emp_man_us_low=[low_skill_share_us(1,6) low_skill_share_us(1,7) low_skill_share_us(1,8) low_skill_share_us(1,9) low_skill_share_us(1,10)]/sum([low_skill_share_us(1,6) low_skill_share_us(1,7) low_skill_share_us(1,8) low_skill_share_us(1,9) low_skill_share_us(1,10)]);
share_emp_it_us_low=[low_skill_share_us(1,1) low_skill_share_us(1,2) low_skill_share_us(1,3) low_skill_share_us(1,4) low_skill_share_us(1,5)]/sum([low_skill_share_us(1,1) low_skill_share_us(1,2) low_skill_share_us(1,3) low_skill_share_us(1,4) low_skill_share_us(1,5)]);
share_emp_fin_us_low=[low_skill_share_us(1,12) low_skill_share_us(1,13) low_skill_share_us(1,14) low_skill_share_us(1,15) low_skill_share_us(1,16)]/sum([low_skill_share_us(1,12) low_skill_share_us(1,13) low_skill_share_us(1,14) low_skill_share_us(1,15) low_skill_share_us(1,16)]);

emp_it_us_low=l_us_IT_us*share_emp_it_us_low(1,1)+l_us_IT_in*share_emp_it_us_low(1,2)+l_us_IT_eu*share_emp_it_us_low(1,3)+l_us_IT_ca*share_emp_it_us_low(1,4)+l_us_IT_ch*share_emp_it_us_low(1,5);
emp_man_us_low=l_us_Man_us*share_emp_man_us_low(1,1)+l_us_Man_in*share_emp_man_us_low(1,2)+l_us_Man_eu*share_emp_man_us_low(1,3)+l_us_Man_ca*share_emp_man_us_low(1,4)+l_us_Man_ch*share_emp_man_us_low(1,5);
emp_fin_us_low=l_us_Fin_us*share_emp_fin_us_low(1,1)+l_us_Fin_in*share_emp_fin_us_low(1,2)+l_us_Fin_eu*share_emp_fin_us_low(1,3)+l_us_Fin_ca*share_emp_fin_us_low(1,4)+l_us_Fin_ch*share_emp_fin_us_low(1,5);



%Welfare

shares_domestic_income=[total_shares_us_us(1,1) total_shares_us_us(1,4) total_shares_us_us(1,7) total_shares_us_in(1,1) total_shares_us_in(1,5)...
    total_shares_us_eu(1,1) total_shares_us_eu(1,5) total_shares_us_ca(1,1) total_shares_us_ca(1,5) total_shares_us_ch(1,1) total_shares_us_ch(1,5)...
    total_shares_us_us(1,10) total_shares_us_in(1,9) total_shares_us_eu(1,9) total_shares_us_ca(1,9) total_shares_us_ch(1,9)]'/sum([total_shares_us_us(1,1)...
    total_shares_us_us(1,4) total_shares_us_us(1,7) total_shares_us_in(1,1) total_shares_us_in(1,5)...
    total_shares_us_eu(1,1) total_shares_us_eu(1,5) total_shares_us_ca(1,1) total_shares_us_ca(1,5) total_shares_us_ch(1,1) total_shares_us_ch(1,5)...
    total_shares_us_us(1,10) total_shares_us_in(1,9) total_shares_us_eu(1,9) total_shares_us_ca(1,9) total_shares_us_ch(1,9)]);


price_index_us=[p_us_IT p_us_Man p_us_Oth p_us_Fin]';

income=[h_us_IT_us_d*w_us_IT_us_d h_us_Man_us_d*w_us_Man_us_d h_us_Oth_us_d*w_us_Oth_us_d h_us_IT_in_d*w_us_IT_in_d h_us_Man_in_d*w_us_Man_in_d...
    h_us_IT_eu_d*w_us_IT_eu_d h_us_Man_eu_d*w_us_Man_eu_d h_us_IT_ca_d*w_us_IT_ca_d h_us_Man_ca_d*w_us_Man_ca_d h_us_IT_ch_d*w_us_IT_ch_d...
    h_us_Man_ch_d*w_us_Man_ch_d h_us_Fin_us_d*w_us_Fin_us_d h_us_Fin_in_d*w_us_Fin_in_d...
    h_us_Fin_eu_d*w_us_Fin_eu_d h_us_Fin_ca_d*w_us_Fin_ca_d...
    h_us_Fin_ch_d*w_us_Fin_ch_d]';


%Change in domestic workers
domestic_workers=(mig_us_IT_us_us*mig_us(1,1)+mig_us_IT_us_in*mig_us(1,2)+mig_us_IT_us_eu*mig_us(1,3)+mig_us_IT_us_ca*mig_us(1,4)+mig_us_IT_us_ch*mig_us(1,5)+...
    mig_us_Man_us_us*mig_us(1,6)+mig_us_Man_us_in*mig_us(1,7)+mig_us_Man_us_eu*mig_us(1,8)+mig_us_Man_us_ca*mig_us(1,9)+mig_us_Man_us_ch*mig_us(1,10)+...    
    mig_us_Oth_us_us*mig_us(1,11)+mig_us_Fin_us_us*mig_us(1,34)+mig_us_Fin_us_in*mig_us(1,35)+mig_us_Fin_us_eu*mig_us(1,36)+mig_us_Fin_us_ca*mig_us(1,37)+mig_us_Fin_us_ch*mig_us(1,38))/(mig_us(1,1)+...
    mig_us(1,2)+mig_us(1,3)+mig_us(1,4)+mig_us(1,5)+mig_us(1,6)+mig_us(1,7)+mig_us(1,8)+mig_us(1,9)+mig_us(1,10)+mig_us(1,11)+mig_us(1,34)+mig_us(1,35)+mig_us(1,36)+mig_us(1,37)+mig_us(1,38));

welfare_us=(sum((income.*shares_domestic_income))/domestic_workers)/(price_index_us(1,1)^gamma(1,1)*price_index_us(2,1)^gamma(1,2)*price_index_us(3,1)^gamma(1,3)*price_index_us(4,1)^gamma(1,4));
welfare_low=w_us_L/(price_index_us(1,1)^gamma(1,1)*price_index_us(2,1)^gamma(1,2)*price_index_us(3,1)^gamma(1,3)*price_index_us(4,1)^gamma(1,4));
total_welfare=welfare_us*0.304+welfare_low*0.696;

wage_high_us=(sum((income.*shares_domestic_income))/domestic_workers);
total_wage_us=wage_high_us*0.304+w_us_L*0.696;

income_mig_us=[h_us_IT_us_f*w_us_IT_us_f h_us_Man_us_f*w_us_Man_us_f h_us_Oth_us_f*w_us_Oth_us_f h_us_IT_in_s*w_us_IT_in_s h_us_IT_in_f*w_us_IT_in_f h_us_Man_in_s*w_us_Man_in_s...
    h_us_Man_in_f*w_us_Man_in_f h_us_IT_eu_s*w_us_IT_eu_s h_us_IT_eu_f*w_us_IT_eu_f h_us_Man_eu_s*w_us_Man_eu_s h_us_Man_eu_f*w_us_Man_eu_f h_us_IT_ca_s*w_us_IT_ca_s...
    h_us_IT_ca_f*w_us_IT_ca_f h_us_Man_ca_s*w_us_Man_ca_s h_us_Man_ca_f*w_us_Man_ca_f h_us_IT_ch_s*w_us_IT_ch_s h_us_IT_ch_f*w_us_IT_ch_f h_us_Man_ch_s*w_us_Man_ch_s h_us_Man_ch_f*w_us_Man_ch_f...
    h_us_Fin_us_f*w_us_Fin_us_f h_us_Fin_in_s*w_us_Fin_in_s h_us_Fin_in_f*w_us_Fin_in_f h_us_Fin_eu_s*w_us_Fin_eu_s h_us_Fin_eu_f*w_us_Fin_eu_f h_us_Fin_ca_s*w_us_Fin_ca_s h_us_Fin_ca_f*w_us_Fin_ca_f...
    h_us_Fin_ch_s*w_us_Fin_ch_s h_us_Fin_ch_f*w_us_Fin_ch_f];

shares_migrant_income=[total_shares_us_us(1,2) total_shares_us_us(1,5) total_shares_us_us(1,8) total_shares_us_in(1,2) total_shares_us_in(1,3) total_shares_us_in(1,6) total_shares_us_in(1,7)...
    total_shares_us_eu(1,2) total_shares_us_eu(1,3) total_shares_us_eu(1,6) total_shares_us_eu(1,7 ) total_shares_us_ca(1,2) total_shares_us_ca(1,3) total_shares_us_ca(1,6) total_shares_us_ca(1,7)...
    total_shares_us_ch(1,2) total_shares_us_ch(1,3) total_shares_us_ch(1,6) total_shares_us_ch(1,7)...
    total_shares_us_us(1,11) total_shares_us_in(1,10) total_shares_us_in(1,11) total_shares_us_eu(1,10) total_shares_us_eu(1,11) total_shares_us_ca(1,10) total_shares_us_ca(1,11)...
    total_shares_us_ch(1,10) total_shares_us_ch(1,11)]/sum([total_shares_us_us(1,2) total_shares_us_us(1,5) total_shares_us_us(1,8) total_shares_us_in(1,2) total_shares_us_in(1,3)...
    total_shares_us_in(1,6) total_shares_us_in(1,7) total_shares_us_eu(1,2) total_shares_us_eu(1,3) total_shares_us_eu(1,6) total_shares_us_eu(1,7) total_shares_us_ca(1,2) total_shares_us_ca(1,3)... 
    total_shares_us_ca(1,6) total_shares_us_ca(1,7) total_shares_us_ch(1,2) total_shares_us_ch(1,3) total_shares_us_ch(1,6) total_shares_us_ch(1,7)...
    total_shares_us_us(1,11) total_shares_us_in(1,10) total_shares_us_in(1,11) total_shares_us_eu(1,10) total_shares_us_eu(1,11) total_shares_us_ca(1,10) total_shares_us_ca(1,11)...
    total_shares_us_ch(1,10) total_shares_us_ch(1,11)]);





%Welfare Europe

shares_domestic_income_eu=[total_shares_eu_eu(1,1) total_shares_eu_eu(1,4) total_shares_eu_eu(1,7) total_shares_eu_in(1,1) total_shares_eu_in(1,5)...
    total_shares_eu_us(1,1) total_shares_eu_us(1,5) total_shares_eu_ca(1,1) total_shares_eu_ca(1,5) total_shares_eu_ch(1,1) total_shares_eu_ch(1,5)...
    total_shares_eu_eu(1,10) total_shares_eu_in(1,9) total_shares_eu_us(1,9) total_shares_eu_ca(1,9) total_shares_eu_ch(1,9)]'/sum([total_shares_eu_eu(1,1) total_shares_eu_eu(1,4) total_shares_eu_eu(1,7) total_shares_eu_in(1,1) total_shares_eu_in(1,5)...
    total_shares_eu_us(1,1) total_shares_eu_us(1,5) total_shares_eu_ca(1,1) total_shares_eu_ca(1,5) total_shares_eu_ch(1,1) total_shares_eu_ch(1,5)...
    total_shares_eu_eu(1,10) total_shares_eu_in(1,9) total_shares_eu_us(1,9) total_shares_eu_ca(1,9) total_shares_eu_ch(1,9)]);


price_index_eu=[p_eu_IT p_eu_Man p_eu_Oth p_eu_Fin]';

income_eu=[h_eu_IT_eu_d*w_eu_IT_eu_d h_eu_Man_eu_d*w_eu_Man_eu_d h_eu_Oth_eu_d*w_eu_Oth_eu_d h_eu_IT_in_d*w_eu_IT_in_d h_eu_Man_in_d*w_eu_Man_in_d...
    h_eu_IT_us_d*w_eu_IT_us_d h_eu_Man_us_d*w_eu_Man_us_d h_eu_IT_ca_d*w_eu_IT_ca_d h_eu_Man_ca_d*w_eu_Man_ca_d h_eu_IT_ch_d*w_eu_IT_ch_d...
    h_eu_Man_ch_d*w_eu_Man_ch_d h_eu_Fin_eu_d*w_eu_Fin_eu_d h_eu_Fin_in_d*w_eu_Fin_in_d h_eu_Fin_us_d*w_eu_Fin_us_d h_eu_Fin_ca_d*w_eu_Fin_ca_d h_eu_Fin_ch_d*w_eu_Fin_ch_d]';

%Change in domestic workers
domestic_workers_eu=(mig_eu_IT_eu_us*mig_eu(1,12)+mig_eu_IT_eu_in*mig_eu(1,13)+mig_eu_IT_eu_eu*mig_eu(1,14)+mig_eu_IT_eu_ca*mig_eu(1,15)+mig_eu_IT_eu_ch*mig_eu(1,16)+...
    mig_eu_Man_eu_us*mig_eu(1,17)+mig_eu_Man_eu_in*mig_eu(1,18)+mig_eu_Man_eu_eu*mig_eu(1,19)+mig_eu_Man_eu_ca*mig_eu(1,20)+mig_eu_Man_eu_ch*mig_eu(1,21)+...    
    mig_eu_Oth_eu_eu*mig_eu(1,22)+mig_eu_Fin_eu_us*mig_eu(1,39)+mig_eu_Fin_eu_in*mig_eu(1,40)+mig_eu_Fin_eu_eu*mig_eu(1,41)+mig_eu_Fin_eu_ca*mig_eu(1,42)+...
    mig_eu_Fin_eu_ch*mig_eu(1,43))/(mig_eu(1,12)+mig_eu(1,13)+mig_eu(1,14)+mig_eu(1,15)+mig_eu(1,16)+mig_eu(1,17)+mig_eu(1,18)+mig_eu(1,19)+mig_eu(1,20)+mig_eu(1,21)+mig_eu(1,22)+...
    mig_eu(1,39)+mig_eu(1,40)+mig_eu(1,41)+mig_eu(1,42)+mig_eu(1,43));

welfare_eu=(sum((income_eu.*shares_domestic_income_eu))/domestic_workers_eu)/(price_index_eu(1,1)^gamma_eu(1,1)*price_index_eu(2,1)^gamma_eu(1,2)*price_index_eu(3,1)^gamma_eu(1,3)*price_index_eu(4,1)^gamma_eu(1,4));
welfare_low_eu=w_eu_L/(price_index_eu(1,1)^gamma_eu(1,1)*price_index_eu(2,1)^gamma_eu(1,2)*price_index_eu(3,1)^gamma_eu(1,3)*price_index_eu(4,1)^gamma_eu(1,4));
total_welfare_eu=welfare_eu*0.27+welfare_low_eu*0.73;

%Welfare Canada

shares_domestic_income_ca=[total_shares_ca_ca(1,1) total_shares_ca_ca(1,4) total_shares_ca_ca(1,7) total_shares_ca_in(1,1) total_shares_ca_in(1,5)...
    total_shares_ca_eu(1,1) total_shares_ca_eu(1,5) total_shares_ca_us(1,1) total_shares_ca_us(1,5) total_shares_ca_ch(1,1) total_shares_ca_ch(1,5)...
    total_shares_ca_ca(1,10) total_shares_ca_in(1,9) total_shares_ca_us(1,9) total_shares_ca_us(1,9) total_shares_ca_ch(1,9)]'/sum([total_shares_ca_ca(1,1) total_shares_ca_ca(1,4),...
    total_shares_ca_ca(1,7) total_shares_ca_in(1,1) total_shares_ca_in(1,5)...
    total_shares_ca_eu(1,1) total_shares_ca_eu(1,5) total_shares_ca_us(1,1) total_shares_ca_us(1,5) total_shares_ca_ch(1,1) total_shares_ca_ch(1,5)...
    total_shares_ca_ca(1,10) total_shares_ca_in(1,9) total_shares_ca_us(1,9) total_shares_ca_us(1,9) total_shares_ca_ch(1,9)]);

income_ca=[h_ca_IT_ca_d*w_ca_IT_ca_d h_ca_Man_ca_d*w_ca_Man_ca_d h_ca_Oth_ca_d*w_ca_Oth_ca_d h_ca_IT_in_d*w_ca_IT_in_d h_ca_Man_in_d*w_ca_Man_in_d...
    h_ca_IT_eu_d*w_ca_IT_eu_d h_ca_Man_eu_d*w_ca_Man_eu_d h_ca_IT_us_d*w_ca_IT_us_d h_ca_Man_us_d*w_ca_Man_us_d h_ca_IT_ch_d*w_ca_IT_ch_d...
    h_ca_Man_ch_d*w_ca_Man_ch_d h_ca_Fin_ca_d*w_ca_Fin_ca_d h_ca_Fin_in_d*w_ca_Fin_in_d h_ca_Fin_eu_d*w_ca_Fin_eu_d h_ca_Fin_us_d*w_ca_Fin_us_d h_ca_Fin_ch_d*w_ca_Fin_ch_d]';

price_index_ca=[p_ca_IT p_ca_Man p_ca_Oth p_ca_Fin]';


%Change in domestic workers
domestic_workers_ca=(mig_ca_IT_ca_us*mig_ca(1,23)+mig_ca_IT_ca_in*mig_ca(1,24)+mig_ca_IT_ca_eu*mig_ca(1,25)+mig_ca_IT_ca_ca*mig_ca(1,26)+mig_ca_IT_ca_ch*mig_ca(1,27)+...
    mig_ca_Man_ca_us*mig_ca(1,28)+mig_ca_Man_ca_in*mig_ca(1,29)+mig_ca_Man_ca_eu*mig_ca(1,30)+mig_ca_Man_ca_ca*mig_ca(1,31)+mig_ca_Man_ca_ch*mig_ca(1,32)+...    
    mig_ca_Oth_ca_ca*mig_ca(1,33)+mig_ca_Fin_ca_us*mig_ca(1,44)+mig_ca_Fin_ca_in*mig_ca(1,45)+mig_ca_Fin_ca_eu*mig_ca(1,46)+mig_ca_Fin_ca_ca*mig_ca(1,47)+...
    mig_ca_Fin_ca_ch*mig_ca(1,48))/(mig_ca(1,23)+mig_ca(1,24)+mig_ca(1,25)+mig_ca(1,26)+mig_ca(1,27)+mig_ca(1,28)+mig_ca(1,29)+mig_ca(1,30)+mig_ca(1,31)+mig_ca(1,32)+mig_ca(1,33)+...
    +mig_ca(1,44)+mig_ca(1,45)+mig_ca(1,46)+mig_ca(1,47)+mig_ca(1,48));

welfare_ca=(sum((income_ca.*shares_domestic_income_ca))/domestic_workers_ca)/(price_index_ca(1,1)^gamma_ca(1,1)*price_index_ca(2,1)^gamma_ca(1,2)*price_index_ca(3,1)^gamma_ca(1,3)*price_index_ca(4,1)^gamma_ca(1,4));
welfare_low_ca=w_ca_L/(price_index_ca(1,1)^gamma_ca(1,1)*price_index_ca(2,1)^gamma_ca(1,2)*price_index_ca(3,1)^gamma_ca(1,3)*price_index_ca(4,1)^gamma_ca(1,4));
total_welfare_ca=welfare_ca*0.23+welfare_low_ca*0.77;

%Welfare India

shares_domestic_income_in=[total_shares_in_in(1,1) total_shares_in_in(1,2) total_shares_in_in(1,3) total_shares_in_us(1,1) total_shares_in_us(1,2)...
    total_shares_in_eu(1,1) total_shares_in_eu(1,2) total_shares_in_ca(1,1) total_shares_in_ca(1,2) total_shares_in_ch(1,1) total_shares_in_ch(1,2)...
    total_shares_in_in(1,7) total_shares_in_us(1,5) total_shares_in_eu(1,5) total_shares_in_ca(1,5) total_shares_in_ch(1,5)]'/sum([total_shares_in_in(1,1)...
    total_shares_in_in(1,2) total_shares_in_in(1,3) total_shares_in_us(1,1) total_shares_in_us(1,2)...
    total_shares_in_eu(1,1) total_shares_in_eu(1,2) total_shares_in_ca(1,1) total_shares_in_ca(1,2) total_shares_in_ch(1,1) total_shares_in_ch(1,2)...
    total_shares_in_in(1,7) total_shares_in_us(1,5) total_shares_in_eu(1,5) total_shares_in_ca(1,5) total_shares_in_ch(1,5)]);

income_in=[h_in_IT_in*w_in_IT_in h_in_Man_in*w_in_Man_in h_in_Oth_in*w_in_Oth_in h_in_IT_us*w_in_IT_us h_in_Man_us*w_in_Man_us...
    h_in_IT_eu*w_in_IT_eu h_in_Man_eu*w_in_Man_eu h_in_IT_ca*w_in_IT_ca h_in_Man_ca*w_in_Man_ca h_in_IT_ch*w_in_IT_ch...
    h_in_Man_ch*w_in_Man_ch h_in_Fin_in*w_in_Fin_in h_in_Fin_us*w_in_Fin_us h_in_Fin_eu*w_in_Fin_eu h_in_Fin_ca*w_in_Fin_ca h_in_Fin_ch*w_in_Fin_ch]';



price_index_in=[p_in_IT p_in_Man p_in_Oth p_in_Fin]';

%Change in domestic workers
domestic_workers_in=(mig_in_IT_in_us*mig_in(1,34)+mig_in_IT_in_in*mig_in(1,35)+mig_in_IT_in_eu*mig_in(1,36)+mig_in_IT_in_ca*mig_in(1,37)+mig_in_IT_in_ch*mig_in(1,38)+...
    mig_in_Man_in_us*mig_in(1,39)+mig_in_Man_in_in*mig_in(1,40)+mig_in_Man_in_eu*mig_in(1,41)+mig_in_Man_in_ca*mig_in(1,42)+mig_in_Man_in_ch*mig_in(1,43)+...    
    mig_in_Oth_in_in*mig_in(1,44)+mig_in_Fin_in_us*mig_in(1,60)+mig_in_Fin_in_in*mig_in(1,61)+mig_in_Fin_in_eu*mig_in(1,62)+mig_in_Fin_in_ca*mig_in(1,63)+...
    mig_in_Fin_in_ch*mig_in(1,64))/(mig_in(1,34)+mig_in(1,35)+mig_in(1,36)+mig_in(1,37)+mig_in(1,38)+mig_in(1,39)+mig_in(1,40)+mig_in(1,41)+mig_in(1,42)+mig_in(1,43)+...
    mig_in(1,44)+mig_in(1,60)+mig_in(1,61)+mig_in(1,62)+mig_in(1,63)+mig_in(1,64));

welfare_in=(sum((income_in.*shares_domestic_income_in))/domestic_workers_in)/(price_index_in(1,1)^gamma_in(1,1)*price_index_in(2,1)^gamma_in(1,2)*price_index_in(3,1)^gamma_in(1,3)*price_index_in(4,1)^gamma_in(1,4));
welfare_low_in=w_in_L/(price_index_in(1,1)^gamma_in(1,1)*price_index_in(2,1)^gamma_in(1,2)*price_index_in(3,1)^gamma_in(1,3)*price_index_in(4,1)^gamma_in(1,4));
total_welfare_in=welfare_in*0.08+welfare_low_in*0.92;


%Welfare China

shares_domestic_income_ch=[total_shares_ch_ch(1,1) total_shares_ch_ch(1,2) total_shares_ch_ch(1,3) total_shares_ch_us(1,1) total_shares_ch_us(1,2)...
    total_shares_ch_in(1,1) total_shares_ch_in(1,2) total_shares_ch_eu(1,1) total_shares_ch_eu(1,2) total_shares_ch_ca(1,1) total_shares_ch_ca(1,2)...
    total_shares_ch_ch(1,7) total_shares_ch_us(1,5) total_shares_ch_in(1,5) total_shares_ch_eu(1,5) total_shares_ch_ca(1,5)]'/sum([total_shares_ch_ch(1,1)...
    total_shares_ch_ch(1,2) total_shares_ch_ch(1,3) total_shares_ch_us(1,1) total_shares_ch_us(1,2)...
    total_shares_ch_in(1,1) total_shares_ch_in(1,2) total_shares_ch_eu(1,1) total_shares_ch_eu(1,2) total_shares_ch_ca(1,1) total_shares_ch_ca(1,2)...
    total_shares_ch_ch(1,7) total_shares_ch_us(1,5) total_shares_ch_in(1,5) total_shares_ch_eu(1,5) total_shares_ch_ca(1,5)]);

income_ch=[h_ch_IT_ch*w_ch_IT_ch h_ch_Man_ch*w_ch_Man_ch h_ch_Oth_ch*w_ch_Oth_ch h_ch_IT_us*w_ch_IT_us h_ch_Man_us*w_ch_Man_us...
    h_ch_IT_in*w_ch_IT_in h_ch_Man_in*w_ch_Man_in h_ch_IT_eu*w_ch_IT_eu h_ch_Man_eu*w_ch_Man_eu h_ch_IT_ca*w_ch_IT_ca...
    h_ch_Man_ca*w_ch_Man_ca h_ch_Fin_ch*w_ch_Fin_ch h_ch_Fin_us*w_ch_Fin_us h_ch_Fin_in*w_ch_Fin_in h_ch_Fin_eu*w_ch_Fin_eu h_ch_Fin_ca*w_ch_Fin_ca]';


price_index_ch=[p_ch_IT p_ch_Man p_ch_Oth p_ch_Fin]';

%Change in domestic workers
domestic_workers_ch=(mig_ch_IT_ch_us*mig_ch(1,34)+mig_ch_IT_ch_in*mig_ch(1,35)+mig_ch_IT_ch_eu*mig_ch(1,36)+mig_ch_IT_ch_ca*mig_ch(1,37)+mig_ch_IT_ch_ch*mig_ch(1,38)+...
    mig_ch_Man_ch_us*mig_ch(1,39)+mig_ch_Man_ch_in*mig_ch(1,40)+mig_ch_Man_ch_eu*mig_ch(1,41)+mig_ch_Man_ch_ca*mig_ch(1,42)+mig_ch_Man_ch_ch*mig_ch(1,43)+...    
    mig_ch_Oth_ch_ch*mig_ch(1,44)+mig_ch_Fin_ch_us*mig_ch(1,60)+mig_ch_Fin_ch_in*mig_ch(1,61)+mig_ch_Fin_ch_eu*mig_ch(1,62)+mig_ch_Fin_ch_ca*mig_ch(1,63)+...
    mig_ch_Fin_ch_ch*mig_ch(1,64))/(mig_ch(1,34)+mig_ch(1,35)+mig_ch(1,36)+mig_ch(1,37)+mig_ch(1,38)+mig_ch(1,39)+mig_ch(1,40)+mig_ch(1,41)+mig_ch(1,42)+mig_ch(1,43)+mig_ch(1,44)+...
    mig_ch(1,60)+mig_ch(1,61)+mig_ch(1,62)+mig_ch(1,63)+mig_ch(1,64));

welfare_ch=(sum((income_ch.*shares_domestic_income_ch))/domestic_workers_ch)/(price_index_ch(1,1)^gamma_ch(1,1)*price_index_ch(2,1)^gamma_ch(1,2)*price_index_ch(3,1)^gamma_ch(1,3)*price_index_ch(4,1)^gamma_ch(1,4));
welfare_low_ch=w_ch_L/(price_index_ch(1,1)^gamma_ch(1,1)*price_index_ch(2,1)^gamma_ch(1,2)*price_index_ch(3,1)^gamma_ch(1,3)*price_index_ch(4,1)^gamma_ch(1,4));
total_welfare_ch=welfare_ch*0.08+welfare_low_ch*0.92;


%Welfare Other

shares_domestic_income_ot=[total_shares_ot(1,1) total_shares_ot(1,2) total_shares_ot(1,3)  total_shares_ot(1,4)]'/sum([total_shares_ot(1,1) total_shares_ot(1,2) total_shares_ot(1,3)  total_shares_ot(1,4)]);

income_ot=[h_ot_IT_ot*w_ot_IT_ot h_ot_Man_ot*w_ot_Man_ot h_ot_Oth_ot*w_ot_Oth_ot h_ot_Fin_ot*w_ot_Fin_ot]';


price_index_ot=[p_ot_IT p_ot_Man p_ot_Oth p_ot_Fin]';

%Change in domestic workers
domestic_workers_ot=(mig_ot_IT_ot_ot*mig_ot(1,34)+mig_ot_Man_ot_ot*mig_ot(1,35)+mig_ot_Oth_ot_ot*mig_ot(1,36)+mig_ot_Fin_ot_ot*mig_ot(1,52))/(mig_ot(1,34)+mig_ot(1,35)+mig_ot(1,36)+mig_ot(1,52));

welfare_ot=(sum((income_ot.*shares_domestic_income_ot))/domestic_workers_ot)/(price_index_ot(1,1)^gamma_ot(1,1)*price_index_ot(2,1)^gamma_ot(1,2)*price_index_ot(3,1)^gamma_ot(1,3)*price_index_ot(4,1)^gamma_ot(1,4));
welfare_low_ot=w_ot_L/(price_index_ot(1,1)^gamma_ot(1,1)*price_index_ot(2,1)^gamma_ot(1,2)*price_index_ot(3,1)^gamma_ot(1,3)*price_index_ot(4,1)^gamma_ot(1,4));
total_welfare_ot=welfare_ot*0.08+welfare_low_ot*0.92;


%Total welfare

welfare_aggregate=[welfare_us welfare_low total_welfare...
    welfare_eu welfare_low_eu total_welfare_eu...
    welfare_ca welfare_low_ca total_welfare_ca...
    welfare_in welfare_low_in total_welfare_in...
    welfare_ch welfare_low_ch total_welfare_ch...
    welfare_ot welfare_low_ot total_welfare_ot]';


%Total migration
migration_abroad=[mig_ca_Man_us_us mig_in_Man_us_us mig_ch_Man_us_us mig_eu_Man_us_us mig_ot_Man_us_us...
    mig_ca_Man_us_ca mig_in_Man_us_ca mig_ch_Man_us_ca mig_eu_Man_us_ca mig_ot_Man_us_ca...
    mig_ca_Man_us_ch mig_in_Man_us_ch mig_ch_Man_us_ch mig_eu_Man_us_ch mig_ot_Man_us_ch...
    mig_ca_Man_us_in mig_in_Man_us_in mig_ch_Man_us_in mig_eu_Man_us_in mig_ot_Man_us_in...
    mig_ca_Man_us_eu mig_in_Man_us_eu mig_ch_Man_us_eu mig_eu_Man_us_eu mig_ot_Man_us_eu...
    mig_ca_IT_us_us mig_in_IT_us_us mig_ch_IT_us_us mig_eu_IT_us_us mig_ot_IT_us_us...
    mig_ca_IT_us_ca mig_in_IT_us_ca mig_ch_IT_us_ca mig_eu_IT_us_ca mig_ot_IT_us_ca...
    mig_ca_IT_us_ch mig_in_IT_us_ch mig_ch_IT_us_ch mig_eu_IT_us_ch mig_ot_IT_us_ch...
    mig_ca_IT_us_in mig_in_IT_us_in mig_ch_IT_us_in mig_eu_IT_us_in mig_ot_IT_us_in...
    mig_ca_IT_us_eu mig_in_IT_us_eu mig_ch_IT_us_eu mig_eu_IT_us_eu mig_ot_IT_us_eu...
    mig_ca_Oth_us_us mig_in_Oth_us_us mig_ch_Oth_us_us mig_eu_Oth_us_us mig_ot_Oth_us_us...
    mig_ca_Fin_us_us mig_in_Fin_us_us mig_ch_Fin_us_us mig_eu_Fin_us_us mig_ot_Fin_us_us...
    mig_ca_Fin_us_ca mig_in_Fin_us_ca mig_ch_Fin_us_ca mig_eu_Fin_us_ca mig_ot_Fin_us_ca...
    mig_ca_Fin_us_ch mig_in_Fin_us_ch mig_ch_Fin_us_ch mig_eu_Fin_us_ch mig_ot_Fin_us_ch...
    mig_ca_Fin_us_in mig_in_Fin_us_in mig_ch_Fin_us_in mig_eu_Fin_us_in mig_ot_Fin_us_in...
    mig_ca_Fin_us_eu mig_in_Fin_us_eu mig_ch_Fin_us_eu mig_eu_Fin_us_eu mig_ot_Fin_us_eu];

migration_shares=[0.002625866	0.033253354	0.007232554	0.00223212	0.007865503...
0.000206008	0.000327872	8.41442E-05	0.000110258	0.000252433...
9.9712E-06	0.000599768	7.77754E-05	4.48704E-06	3.39021E-05...
5.66653E-06	0.000188255	2.51846E-06	3.14807E-06	8.18499E-06...
0.001125963	0.010016216	0.001830647	0.001008515	0.003316611...
0.003487783	0.12617343	0.008751747	0.003721947	0.014875713...
1.59446E-05	0.000236606	1.76529E-05	1.12466E-05	3.14621E-05...
5.89517E-08	4.90478E-06	2.65283E-06	2.00436E-07	1.02576E-06...
7.1191E-05	0.00364932	4.10384E-05	5.8605E-05	0.00010707...
0.000572612	0.020811345	0.000981303	0.000758786	0.002409867...
0.041573757	0.377195911	0.067241175	0.039952316	0.1535505...
0.001475668	0.019448042	0.004958523	0.001514832	0.004891384...
0.000253959	0.000645782	0.000330147	0.000119724	0.000341031...
9.52106E-06	9.28303E-05	0.00027373	3.5704E-05	8.0929E-05...
5.32537E-06	7.45429E-05	5.32537E-06	6.39044E-05	4.26029E-05...
0.001243482	0.012346701	0.00351504	0.0032262	0.006276158];



mig_change=sum(migration_abroad.*migration_shares);


mig_change1=(mig_in_Man_us_in*migration_shares(1,17)+mig_in_IT_us_in*migration_shares(1,42)+mig_in_Fin_us_in*migration_shares(1,72))/(migration_shares(1,17)+migration_shares(1,42)+migration_shares(1,72));
mig_change2=(mig_ch_Man_us_ch*migration_shares(1,13)+mig_ch_IT_us_ch*migration_shares(1,38)+mig_ch_Fin_us_ch*migration_shares(1,68))/(migration_shares(1,13)+migration_shares(1,38)+migration_shares(1,68));
mig_change3=(mig_eu_Man_us_eu*migration_shares(1,24)+mig_eu_IT_us_eu*migration_shares(1,49)+mig_eu_Fin_us_eu*migration_shares(1,79))/(migration_shares(1,24)+migration_shares(1,49)+migration_shares(1,79));
mig_change4=(mig_ca_Man_us_ca*migration_shares(1,6)+mig_ca_IT_us_ca*migration_shares(1,31)+mig_ca_Fin_us_ca*migration_shares(1,61))/(migration_shares(1,6)+migration_shares(1,31)+migration_shares(1,61));




%Migration by origin country

mig_shares_ca=[migration_shares(1,1) migration_shares(1,6) migration_shares(1,11) migration_shares(1,16) migration_shares(1,21) migration_shares(1,26) migration_shares(1,31) migration_shares(1,36) migration_shares(1,41)...
    migration_shares(1,46) migration_shares(1,51) migration_shares(1,56) migration_shares(1,61) migration_shares(1,66) migration_shares(1,71)...
    migration_shares(1,76)]/sum([migration_shares(1,1) migration_shares(1,6) migration_shares(1,11) migration_shares(1,16) migration_shares(1,21) migration_shares(1,26) migration_shares(1,31) migration_shares(1,36) migration_shares(1,41)...
    migration_shares(1,46) migration_shares(1,51) migration_shares(1,56) migration_shares(1,61) migration_shares(1,66) migration_shares(1,71)...
    migration_shares(1,76)]);

mig_shares_in=[migration_shares(1,2) migration_shares(1,7) migration_shares(1,12) migration_shares(1,17) migration_shares(1,22) migration_shares(1,27) migration_shares(1,32) migration_shares(1,37) migration_shares(1,42)...
    migration_shares(1,47) migration_shares(1,52) migration_shares(1,57) migration_shares(1,62) migration_shares(1,67) migration_shares(1,72)...
    migration_shares(1,77)]/sum([migration_shares(1,2) migration_shares(1,7) migration_shares(1,12) migration_shares(1,17) migration_shares(1,22) migration_shares(1,27) migration_shares(1,32) migration_shares(1,37) migration_shares(1,42)...
    migration_shares(1,47) migration_shares(1,52) migration_shares(1,57) migration_shares(1,62) migration_shares(1,67) migration_shares(1,72)...
    migration_shares(1,77)]);

mig_shares_ch=[migration_shares(1,3) migration_shares(1,8) migration_shares(1,13) migration_shares(1,18) migration_shares(1,23) migration_shares(1,28) migration_shares(1,33) migration_shares(1,38) migration_shares(1,43)...
    migration_shares(1,48) migration_shares(1,53) migration_shares(1,58) migration_shares(1,63) migration_shares(1,68) migration_shares(1,73)...
    migration_shares(1,78)]/sum([migration_shares(1,3) migration_shares(1,8) migration_shares(1,13) migration_shares(1,18) migration_shares(1,23) migration_shares(1,28) migration_shares(1,33) migration_shares(1,38) migration_shares(1,43)...
    migration_shares(1,48) migration_shares(1,53) migration_shares(1,58) migration_shares(1,63) migration_shares(1,68) migration_shares(1,73)...
    migration_shares(1,78)]);

mig_shares_eu=[migration_shares(1,4) migration_shares(1,9) migration_shares(1,14) migration_shares(1,19) migration_shares(1,24) migration_shares(1,29) migration_shares(1,34) migration_shares(1,39) migration_shares(1,44)...
    migration_shares(1,49) migration_shares(1,54) migration_shares(1,59) migration_shares(1,64) migration_shares(1,69) migration_shares(1,74)...
    migration_shares(1,79)]/sum([migration_shares(1,4) migration_shares(1,9) migration_shares(1,14) migration_shares(1,19) migration_shares(1,24) migration_shares(1,29) migration_shares(1,34) migration_shares(1,39) migration_shares(1,44)...
    migration_shares(1,49) migration_shares(1,54) migration_shares(1,59) migration_shares(1,64) migration_shares(1,69) migration_shares(1,74)...
    migration_shares(1,79)]);

mig_shares_ot=[migration_shares(1,5) migration_shares(1,10) migration_shares(1,15) migration_shares(1,20) migration_shares(1,25) migration_shares(1,30) migration_shares(1,35) migration_shares(1,40) migration_shares(1,45)...
    migration_shares(1,50) migration_shares(1,55) migration_shares(1,60) migration_shares(1,65) migration_shares(1,70) migration_shares(1,75)...
    migration_shares(1,80)]/sum([migration_shares(1,5) migration_shares(1,10) migration_shares(1,15) migration_shares(1,20) migration_shares(1,25) migration_shares(1,30) migration_shares(1,35) migration_shares(1,40) migration_shares(1,45)...
    migration_shares(1,50) migration_shares(1,55) migration_shares(1,60) migration_shares(1,65) migration_shares(1,70) migration_shares(1,75)...
    migration_shares(1,80)]);


mig_us_ca=mig_ca_Man_us_us*mig_shares_ca(1,1)+mig_ca_Man_us_ca*mig_shares_ca(1,2)+mig_ca_Man_us_ch*mig_shares_ca(1,3)+mig_ca_Man_us_in*mig_shares_ca(1,4)+mig_ca_Man_us_eu*mig_shares_ca(1,5)+mig_ca_IT_us_us*mig_shares_ca(1,6)+mig_ca_IT_us_ca*mig_shares_ca(1,7)+mig_ca_IT_us_ch*mig_shares_ca(1,8)+...
    mig_ca_IT_us_in*mig_shares_ca(1,9)+mig_ca_IT_us_eu*mig_shares_ca(1,10)+mig_ca_Oth_us_us*mig_shares_ca(1,11)+mig_ca_Fin_us_us*mig_shares_ca(1,12)+mig_ca_Fin_us_ca*mig_shares_ca(1,13)+mig_ca_Fin_us_ch*mig_shares_ca(1,14)+mig_ca_Fin_us_in*mig_shares_ca(1,15)+mig_ca_Fin_us_eu*mig_shares_ca(1,16);

mig_us_in=mig_in_Man_us_us*mig_shares_in(1,1)+mig_in_Man_us_ca*mig_shares_in(1,2)+mig_in_Man_us_ch*mig_shares_in(1,3)+mig_in_Man_us_in*mig_shares_in(1,4)+mig_in_Man_us_eu*mig_shares_in(1,5)+mig_in_IT_us_us*mig_shares_in(1,6)+mig_in_IT_us_ca*mig_shares_in(1,7)+mig_in_IT_us_ch*mig_shares_in(1,8)+...
    mig_in_IT_us_in*mig_shares_in(1,9)+mig_in_IT_us_eu*mig_shares_in(1,10)+mig_in_Oth_us_us*mig_shares_in(1,11)+mig_in_Fin_us_us*mig_shares_in(1,12)+mig_in_Fin_us_ca*mig_shares_in(1,13)+mig_in_Fin_us_ch*mig_shares_in(1,14)+mig_in_Fin_us_in*mig_shares_in(1,15)+mig_in_Fin_us_eu*mig_shares_in(1,16);

mig_us_ch=mig_ch_Man_us_us*mig_shares_ch(1,1)+mig_ch_Man_us_ca*mig_shares_ch(1,2)+mig_ch_Man_us_ch*mig_shares_ch(1,3)+mig_ch_Man_us_in*mig_shares_ch(1,4)+mig_ch_Man_us_eu*mig_shares_ch(1,5)+mig_ch_IT_us_us*mig_shares_ch(1,6)+mig_ch_IT_us_ca*mig_shares_ch(1,7)+mig_ch_IT_us_ch*mig_shares_ch(1,8)+...
    mig_ch_IT_us_in*mig_shares_ch(1,9)+mig_ch_IT_us_eu*mig_shares_ch(1,10)+mig_ch_Oth_us_us*mig_shares_ch(1,11)+mig_ch_Fin_us_us*mig_shares_ch(1,12)+mig_ch_Fin_us_ca*mig_shares_ch(1,13)+mig_ch_Fin_us_ch*mig_shares_ch(1,14)+mig_ch_Fin_us_in*mig_shares_ch(1,15)+mig_ch_Fin_us_eu*mig_shares_ch(1,16);

mig_us_eu=mig_eu_Man_us_us*mig_shares_eu(1,1)+mig_eu_Man_us_ca*mig_shares_eu(1,2)+mig_eu_Man_us_ch*mig_shares_eu(1,3)+mig_eu_Man_us_in*mig_shares_eu(1,4)+mig_eu_Man_us_eu*mig_shares_eu(1,5)+mig_eu_IT_us_us*mig_shares_eu(1,6)+mig_eu_IT_us_ca*mig_shares_eu(1,7)+mig_eu_IT_us_ch*mig_shares_eu(1,8)+...
    mig_eu_IT_us_in*mig_shares_eu(1,9)+mig_eu_IT_us_eu*mig_shares_eu(1,10)+mig_eu_Oth_us_us*mig_shares_eu(1,11)+mig_eu_Fin_us_us*mig_shares_eu(1,12)+mig_eu_Fin_us_ca*mig_shares_eu(1,13)+mig_eu_Fin_us_ch*mig_shares_eu(1,14)+mig_eu_Fin_us_in*mig_shares_eu(1,15)+mig_eu_Fin_us_eu*mig_shares_eu(1,16);

mig_us_ot=mig_ot_Man_us_us*mig_shares_ot(1,1)+mig_ot_Man_us_ca*mig_shares_ot(1,2)+mig_ot_Man_us_ch*mig_shares_ot(1,3)+mig_ot_Man_us_in*mig_shares_ot(1,4)+mig_ot_Man_us_eu*mig_shares_ot(1,5)+mig_ot_IT_us_us*mig_shares_ot(1,6)+mig_ot_IT_us_ca*mig_shares_ot(1,7)+mig_ot_IT_us_ch*mig_shares_ot(1,8)+...
    mig_ot_IT_us_in*mig_shares_ot(1,9)+mig_ot_IT_us_eu*mig_shares_ot(1,10)+mig_ot_Oth_us_us*mig_shares_ot(1,11)+mig_ot_Fin_us_us*mig_shares_ot(1,12)+mig_ot_Fin_us_ca*mig_shares_ot(1,13)+mig_ot_Fin_us_ch*mig_shares_ot(1,14)+mig_ot_Fin_us_in*mig_shares_ot(1,15)+mig_ot_Fin_us_eu*mig_shares_ot(1,16);



%Migration to canada


migration_abroad_ca=[mig_us_IT_ca_us mig_us_IT_ca_in mig_us_IT_ca_eu mig_us_IT_ca_ca mig_us_IT_ca_ch...
mig_us_Man_ca_us mig_us_Man_ca_in mig_us_Man_ca_eu mig_us_Man_ca_ca mig_us_Man_ca_ch...
mig_us_Oth_ca_ca...
mig_eu_IT_ca_us mig_eu_IT_ca_in mig_eu_IT_ca_eu mig_eu_IT_ca_ca mig_eu_IT_ca_ch...
mig_eu_Man_ca_us mig_eu_Man_ca_in mig_eu_Man_ca_eu mig_eu_Man_ca_ca mig_eu_Man_ca_ch...
mig_eu_Oth_ca_ca...
mig_in_IT_ca_us mig_in_IT_ca_in mig_in_IT_ca_eu mig_in_IT_ca_ca mig_in_IT_ca_ch...
mig_in_Man_ca_us mig_in_Man_ca_in mig_in_Man_ca_eu mig_in_Man_ca_ca mig_in_Man_ca_ch...
mig_in_Oth_ca_ca...
mig_ch_IT_ca_us mig_ch_IT_ca_in mig_ch_IT_ca_eu mig_ch_IT_ca_ca mig_ch_IT_ca_ch...
mig_ch_Man_ca_us mig_ch_Man_ca_in mig_ch_Man_ca_eu mig_ch_Man_ca_ca mig_ch_Man_ca_ch... 
mig_ch_Oth_ca_ca...
mig_ot_IT_ca_us mig_ot_IT_ca_in mig_ot_IT_ca_eu mig_ot_IT_ca_ca mig_ot_IT_ca_ch...
mig_ot_Man_ca_us mig_ot_Man_ca_in mig_ot_Man_ca_eu mig_ot_Man_ca_ca mig_ot_Man_ca_ch...
mig_ot_Oth_ca_ca...
mig_us_Fin_ca_us mig_us_Fin_ca_in mig_us_Fin_ca_eu mig_us_Fin_ca_ca mig_us_Fin_ca_ch...
mig_eu_Fin_ca_us mig_eu_Fin_ca_in mig_eu_Fin_ca_eu mig_eu_Fin_ca_ca mig_eu_Fin_ca_ch...
mig_in_Fin_ca_us mig_in_Fin_ca_in mig_in_Fin_ca_eu mig_in_Fin_ca_ca mig_in_Fin_ca_ch...
mig_ch_Fin_ca_us mig_ch_Fin_ca_in mig_ch_Fin_ca_eu mig_ch_Fin_ca_ca mig_ch_Fin_ca_ch...
mig_ot_Fin_ca_us mig_ot_Fin_ca_in mig_ot_Fin_ca_eu mig_ot_Fin_ca_ca mig_ot_Fin_ca_ch];



migration_shares_ca=[0.002094265	1.27745E-07	2.16925E-05	0.007985385	1.25234E-05...	
0.005582421	1.19536E-07	8.68855E-06	0.000495105	3.47734E-06...	
0.034265421...
0.002976497	4.47278E-07	0.000100705	0.027959427	4.38485E-05...	
0.006116451	6.02329E-07	6.40144E-05	0.002494784	1.7522E-05...	
0.10272754...
0.00157609	2.78367E-07	4.02176E-05	0.014804841	2.32183E-05...	
0.006767692	1.03234E-06	4.84422E-05	0.002760413	1.93876E-05...	
0.071570015...
0.001950516	2.93104E-07	4.9772E-05	0.018321976	0.000363685...	
0.006077421	5.98486E-07	4.35013E-05	0.002478864	1.33668E-05...	
0.056689046...
0.009468501	1.42283E-06	0.000241611	0.088941407	0.000139486...	
0.034132428	3.36126E-06	0.000244315	0.013921967	9.77801E-05...	
0.430372212...
0.0007107	4.71677E-08	1.59452E-06	0.00119484	4.67643E-09...						
0.000783107	1.84217E-07	2.05489E-05	0.004666546	1.82642E-08...						
0.000754543	1.09512E-07	6.00039E-06	0.004496333	1.7598E-08...						
0.000820167	1.92935E-07	6.52226E-06	0.004887387	1.11161E-07...						
0.003949178	9.29E-07	3.14052E-05	0.023533198	9.21055E-08];

mig_change_ca=sum(migration_abroad_ca.*migration_shares_ca);

%Migration to Europe

migration_abroad_eu=[mig_us_IT_eu_us mig_us_IT_eu_in mig_us_IT_eu_eu mig_us_IT_eu_ca mig_us_IT_eu_ch...
mig_us_Man_eu_us mig_us_Man_eu_in mig_us_Man_eu_eu mig_us_Man_eu_ca mig_us_Man_eu_ch...
mig_us_Oth_eu_eu...
mig_ca_IT_eu_us mig_ca_IT_eu_in mig_ca_IT_eu_eu mig_ca_IT_eu_ca mig_ca_IT_eu_ch...
mig_ca_Man_eu_us mig_ca_Man_eu_in mig_ca_Man_eu_eu mig_ca_Man_eu_ca mig_ca_Man_eu_ch...
mig_ca_Oth_eu_eu...
mig_in_IT_eu_us mig_in_IT_eu_in mig_in_IT_eu_eu mig_in_IT_eu_ca mig_in_IT_eu_ch...
mig_in_Man_eu_us mig_in_Man_eu_in mig_in_Man_eu_eu mig_in_Man_eu_ca mig_in_Man_eu_ch...
mig_in_Oth_eu_eu...
mig_ch_IT_eu_us mig_ch_IT_eu_in mig_ch_IT_eu_eu mig_ch_IT_eu_ca mig_ch_IT_eu_ch...
mig_ch_Man_eu_us mig_ch_Man_eu_in mig_ch_Man_eu_eu mig_ch_Man_eu_ca mig_ch_Man_eu_ch...
mig_ch_Oth_eu_eu...
mig_ot_IT_eu_us mig_ot_IT_eu_in mig_ot_IT_eu_eu mig_ot_IT_eu_ca mig_ot_IT_eu_ch...
mig_ot_Man_eu_us mig_ot_Man_eu_in mig_ot_Man_eu_eu mig_ot_Man_eu_ca mig_ot_Man_eu_ch...
mig_ot_Oth_eu_eu...
mig_us_Fin_eu_us mig_us_Fin_eu_in mig_us_Fin_eu_eu mig_us_Fin_eu_ca mig_us_Fin_eu_ch...
mig_ca_Fin_eu_us mig_ca_Fin_eu_in mig_ca_Fin_eu_eu mig_ca_Fin_eu_ca mig_ca_Fin_eu_ch...
mig_in_Fin_eu_us mig_in_Fin_eu_in mig_in_Fin_eu_eu mig_in_Fin_eu_ca mig_in_Fin_eu_ch...
mig_ch_Fin_eu_us mig_ch_Fin_eu_in mig_ch_Fin_eu_eu mig_ch_Fin_eu_ca mig_ch_Fin_eu_ch...
mig_ot_Fin_eu_us mig_ot_Fin_eu_in mig_ot_Fin_eu_eu mig_ot_Fin_eu_ca mig_ot_Fin_eu_ch];


migration_shares_eu=[0.000932423	1.93762E-05	0.008889599	3.65276E-05	1.9529E-05...	
0.000546424	1.96882E-05	0.001478215	8.65161E-06	3.80074E-05...	
0.039125427...
0.000433467	1.15151E-05	0.00528299	2.17079E-05	7.73948E-05...	
0.00016728	8.58274E-06	0.000644402	3.77152E-06	1.29888E-05...	
0.028886509...
0.000256993	6.82701E-06	0.003132166	3.05355E-05	6.88087E-06...	
0.000188933	9.69366E-06	0.000727811	2.005E-05	1.87133E-05...	
0.009788118...
0.000389438	1.2037E-05	0.004746373	1.9503E-05	1.0427E-05...	
0.000261354	1.98073E-05	0.001006793	5.8925E-06	2.58863E-05...	
0.044928231...
0.008470829	0.000225027	0.103240315	0.000424217	0.000226803...	
0.005618019	0.000288247	0.021641879	0.000126664	0.000556449...	
0.663214993...
0.000916614	2.67468E-05	0.002619044	2.71482E-05	7.47573E-05...						
0.000157011	1.34784E-05	0.001319801	1.36807E-05	0.000150996...						
9.20938E-05	7.90568E-06	0.000774122	2.77382E-05	2.20963E-05...						
0.000165714	9.05834E-06	0.001392961	1.4439E-05	3.97603E-05...						
0.003648588	0.000313209	0.030669329	0.000317909	0.000875417];

mig_change_eu=sum(migration_abroad_eu.*migration_shares_eu);


%variables=[Revenues;US_Rev_source;Trade_shares_us_exporter;Trade_shares_us_importer;Native_employment;average_wage_IT;average_wage_Man;average_wage_IT_total;average_wage_Man_total;total_change_IT;total_change_Man;trade_us_us_IT;trade_us_us_Man;trade_ca_us_Oth;price_index_us; income; migration_abroad' ;welfare_us;welfare_low;total_welfare];

%Employment MNEs

%IT Man				
%low skill	domestic	source	foreign

employment_shares_us=[0.390536756	0.549405325	0	0.060057919	0.452899804	0.511643957	0	0.035456238	0.502851732	0.471628684	0	0.025519585];
employment_shares_in=[0.390536756	0.068941975	0.502272076	0.038249193	0.452899804	0.369819004	0.160627504	0.016653688	0.502851732	0.13987408	0.138926068	0.21834812];
employment_shares_eu=[0.390536756	0.37968163	0.006828369	0.222953245	0.452899804	0.508854244	0.002229838	0.036016113	0.502851732	0.355273375	0.017202494	0.124672399];
employment_shares_ca=[0.390536756	0.545585231	0.003254931	0.060623082	0.452899804	0.508854244	0.008033913	0.030212038	0.502851732	0.451823253	0.006808479	0.038516537];
employment_shares_ch=[0.390536756	0.510931527	0.029559515	0.068972201	0.452899804	0.315573108	0.024806474	0.206720614	0.502851732	0.064658461	0.240272115	0.192217692];
				

employment_us_IT_us=(l_us_IT_us*employment_shares_us(1,1)+mig_us_IT_us_us*employment_shares_us(1,2)+employment_shares_us(1,4)*(mig_in_IT_us_us*Foreign_IT_us_us(1,1)+...
    mig_eu_IT_us_us*Foreign_IT_us_us(1,2)+mig_ca_IT_us_us*Foreign_IT_us_us(1,3)+mig_ch_IT_us_us*Foreign_IT_us_us(1,4)+mig_ot_IT_us_us*Foreign_IT_us_us(1,5)))/sum([employment_shares_us(1,1) employment_shares_us(1,2) employment_shares_us(1,4)]);

employment_us_Man_us=(l_us_Man_us*employment_shares_us(1,5)+mig_us_Man_us_us*employment_shares_us(1,6)+employment_shares_us(1,8)*(mig_in_Man_us_us*Foreign_Man_us_us(1,1)+...
    mig_eu_Man_us_us*Foreign_Man_us_us(1,2)+mig_ca_Man_us_us* Foreign_Man_us_us(1,3)+mig_ch_Man_us_us*Foreign_Man_us_us(1,4)+mig_ot_Man_us_us*Foreign_Man_us_us(1,5)))/sum([employment_shares_us(1,5) employment_shares_us(1,6) employment_shares_us(1,8)]);

employment_us_IT_in=(l_us_IT_in*employment_shares_in(1,1)+mig_us_IT_us_in*employment_shares_in(1,2)+mig_in_IT_us_in*employment_shares_in(1,3)+...
    employment_shares_in(1,4)*(mig_eu_IT_us_in*Foreign_IT_us_in(1,1)+mig_ca_IT_us_in*Foreign_IT_us_in(1,2)+mig_ch_IT_us_in*Foreign_IT_us_in(1,3)+mig_ot_IT_us_in*Foreign_IT_us_in(1,4)))/sum([employment_shares_in(1,1) employment_shares_in(1,2) employment_shares_in(1,3) employment_shares_in(1,4)]);

employment_us_Man_in=(l_us_Man_in*employment_shares_in(1,5)+mig_us_Man_us_in*employment_shares_in(1,6)+mig_in_Man_us_in*employment_shares_in(1,7)+...
    employment_shares_in(1,8)*(mig_eu_Man_us_in*Foreign_Man_us_in(1,1)+mig_ca_Man_us_in*Foreign_Man_us_in(1,2)+mig_ch_Man_us_in*Foreign_Man_us_in(1,3)+mig_ot_Man_us_in*Foreign_Man_us_in(1,4)))/sum([employment_shares_in(1,5) employment_shares_in(1,6) employment_shares_in(1,7) employment_shares_in(1,8)]);

employment_us_IT_eu=(l_us_IT_eu*employment_shares_eu(1,1)+mig_us_IT_us_eu*employment_shares_eu(1,2)+mig_eu_IT_us_eu*employment_shares_eu(1,3)+...
    employment_shares_eu(1,4)*(mig_eu_IT_us_eu*Foreign_IT_us_eu(1,1)+mig_ca_IT_us_eu*Foreign_IT_us_eu(1,2)+mig_ch_IT_us_eu*Foreign_IT_us_eu(1,3)+mig_ot_IT_us_eu*Foreign_IT_us_eu(1,4)))/sum([employment_shares_eu(1,1) employment_shares_eu(1,2) employment_shares_eu(1,3) employment_shares_eu(1,4)]);

employment_us_Man_eu=(l_us_Man_eu*employment_shares_eu(1,5)+mig_us_Man_us_eu*employment_shares_eu(1,6)+mig_eu_Man_us_eu*employment_shares_eu(1,7)+...
    employment_shares_eu(1,8)*(mig_in_Man_us_eu*Foreign_Man_us_eu(1,1)+mig_ca_Man_us_eu*Foreign_Man_us_eu(1,2)+mig_ch_Man_us_eu*Foreign_Man_us_eu(1,3)+mig_ot_Man_us_eu*Foreign_Man_us_eu(1,4)))/sum([employment_shares_eu(1,5) employment_shares_eu(1,6) employment_shares_eu(1,7) employment_shares_eu(1,8)]);

employment_us_IT_ca=(l_us_IT_ca*employment_shares_ca(1,1)+mig_us_IT_us_ca*employment_shares_ca(1,2)+mig_ca_IT_us_ca*employment_shares_ca(1,3)+...
    employment_shares_ca(1,4)*(mig_in_IT_us_ca*Foreign_IT_us_ca(1,1)+mig_eu_IT_us_ca*Foreign_IT_us_ca(1,2)+mig_ch_IT_us_ca*Foreign_IT_us_ca(1,3)+mig_ot_IT_us_ca*Foreign_IT_us_ca(1,4)))/sum([employment_shares_ca(1,1) employment_shares_ca(1,2) employment_shares_ca(1,3) employment_shares_ca(1,4)]);

employment_us_Man_ca=(l_us_Man_ca*employment_shares_ca(1,5)+mig_us_Man_us_ca*employment_shares_ca(1,6)+mig_ca_Man_us_ca*employment_shares_ca(1,7)+...
    employment_shares_ca(1,8)*(mig_in_Man_us_ca*Foreign_Man_us_ca(1,1)+mig_eu_Man_us_ca*Foreign_Man_us_ca(1,2)+mig_ch_Man_us_ca*Foreign_Man_us_ca(1,3)+mig_ot_Man_us_ca*Foreign_Man_us_ca(1,4)))/sum([employment_shares_ca(1,5) employment_shares_ca(1,6) employment_shares_ca(1,7) employment_shares_ca(1,8)]);

employment_us_IT_ch=(l_us_IT_ch*employment_shares_ch(1,1)+mig_us_IT_us_ch*employment_shares_ch(1,2)+mig_ch_IT_us_ch*employment_shares_ch(1,3)+...
    employment_shares_ch(1,4)*(mig_in_IT_us_ch*Foreign_IT_us_ch(1,1)+mig_eu_IT_us_ch*Foreign_IT_us_ch(1,2)+mig_ca_IT_us_ch*Foreign_IT_us_ch(1,3)+mig_ot_IT_us_ch*Foreign_IT_us_ch(1,4)))/sum([employment_shares_ch(1,1) employment_shares_ch(1,2) employment_shares_ch(1,3) employment_shares_ch(1,4)]);

employment_us_Man_ch=(l_us_Man_ch*employment_shares_ch(1,5)+mig_us_Man_us_ch*employment_shares_ch(1,6)+mig_ch_Man_us_ch*employment_shares_ch(1,7)+...
    employment_shares_ch(1,8)*(mig_in_Man_us_ch*Foreign_Man_us_ch(1,1)+mig_eu_Man_us_ch*Foreign_Man_us_ch(1,2)+mig_ca_Man_us_ch*Foreign_Man_us_ch(1,3)+mig_ot_Man_us_ch*Foreign_Man_us_ch(1,4)))/sum([employment_shares_ch(1,5) employment_shares_ch(1,6) employment_shares_ch(1,7) employment_shares_ch(1,8)]);




employment_us_Fin_us=(l_us_Fin_us*employment_shares_us(1,9)+mig_us_Fin_us_us*employment_shares_us(1,10)+employment_shares_us(1,12)*(mig_in_Fin_us_us*Foreign_Fin_us_us(1,1)+...
    mig_eu_Fin_us_us*Foreign_Fin_us_us(1,2)+mig_ca_Fin_us_us* Foreign_Fin_us_us(1,3)+mig_ch_Fin_us_us*Foreign_Fin_us_us(1,4)+mig_ot_Fin_us_us*Foreign_Fin_us_us(1,5)))/sum([employment_shares_us(1,9) employment_shares_us(1,10) employment_shares_us(1,12)]);
employment_us_Fin_in=(l_us_Fin_in*employment_shares_in(1,9)+mig_us_Fin_us_in*employment_shares_in(1,10)+mig_in_Fin_us_in*employment_shares_in(1,11)+...
    employment_shares_in(1,12)*(mig_eu_Fin_us_in*Foreign_Fin_us_in(1,1)+mig_ca_Fin_us_in*Foreign_Fin_us_in(1,2)+mig_ch_Fin_us_in*Foreign_Fin_us_in(1,3)+mig_ot_Fin_us_in*Foreign_Fin_us_in(1,4)))/sum([employment_shares_in(1,9) employment_shares_in(1,10) employment_shares_in(1,11) employment_shares_in(1,12)]);
employment_us_Fin_eu=(l_us_Fin_eu*employment_shares_eu(1,9)+mig_us_Fin_us_eu*employment_shares_eu(1,10)+mig_eu_Fin_us_eu*employment_shares_eu(1,11)+...
    employment_shares_eu(1,12)*(mig_in_Fin_us_eu*Foreign_Fin_us_eu(1,1)+mig_ca_Fin_us_eu*Foreign_Fin_us_eu(1,2)+mig_ch_Fin_us_eu*Foreign_Fin_us_eu(1,3)+mig_ot_Fin_us_eu*Foreign_Fin_us_eu(1,4)))/sum([employment_shares_eu(1,9) employment_shares_eu(1,10) employment_shares_eu(1,11) employment_shares_eu(1,12)]);
employment_us_Fin_ca=(l_us_Fin_ca*employment_shares_ca(1,9)+mig_us_Fin_us_ca*employment_shares_ca(1,10)+mig_ca_Fin_us_ca*employment_shares_ca(1,11)+...
    employment_shares_ca(1,12)*(mig_in_Fin_us_ca*Foreign_Fin_us_ca(1,1)+mig_eu_Fin_us_ca*Foreign_Fin_us_ca(1,2)+mig_ch_Fin_us_ca*Foreign_Fin_us_ca(1,3)+mig_ot_Fin_us_ca*Foreign_Fin_us_ca(1,4)))/sum([employment_shares_ca(1,9) employment_shares_ca(1,10) employment_shares_ca(1,11) employment_shares_ca(1,12)]);
employment_us_Fin_ch=(l_us_Fin_ch*employment_shares_ch(1,9)+mig_us_Fin_us_ch*employment_shares_ch(1,10)+mig_ch_Fin_us_ch*employment_shares_ch(1,11)+...
    employment_shares_ch(1,12)*(mig_in_Fin_us_ch*Foreign_Fin_us_ch(1,1)+mig_eu_Fin_us_ch*Foreign_Fin_us_ch(1,2)+mig_ca_Fin_us_ch*Foreign_Fin_us_ch(1,3)+mig_ot_Fin_us_ch*Foreign_Fin_us_ch(1,4)))/sum([employment_shares_ch(1,9) employment_shares_ch(1,10) employment_shares_ch(1,11) employment_shares_ch(1,12)]);


variables=[native_emp_IT_tot; native_emp_Man_tot; emp_it_us_low; emp_man_us_low; welfare_aggregate; Revenues; total_output; Trade_shares_us_importer;...
    domestic_trade_share_us; mig_change; mig_change_ca; mig_change_eu; mig_us_ca; mig_us_in; mig_us_ch; mig_us_eu; mig_us_ot; US_Rev_source; mne_shares;...
    wage_high_us; w_us_L; total_wage_us; employment_us_IT_us; employment_us_Man_us; employment_us_IT_in; employment_us_Man_in; employment_us_IT_eu; employment_us_Man_eu;...
    employment_us_IT_ca; employment_us_Man_ca; employment_us_IT_ch; employment_us_Man_ch;...
    native_emp_Fin_tot; emp_fin_us_low; Revenues_Fin; Trade_shares_us_importer_Fin; US_Rev_source_Fin; mne_shares_Fin; employment_us_Fin_us; employment_us_Fin_in; employment_us_Fin_eu;...
    employment_us_Fin_ca; employment_us_Fin_ch];


wage_mig_us=sum(income_mig_us.*shares_migrant_income)/mig_change;

%observed changes
wage_fh=wage_mig_us/wage_high_us;
wage_hl=(wage_mig_us*(1-9.02E-01)+wage_high_us*9.02E-01)/w_us_L;

emp_hl=mig_change*(1-9.02E-01)+domestic_workers*9.02E-01;
emp_fh=mig_change/domestic_workers;

ratio1=h_us_Oth_us_f/h_us_Oth_us_d;
ratio2=w_us_Oth_us_f/w_us_Oth_us_d;



%While this is large, loop continues
omega_crit2=abs(mig_change-target_mig);

mig_cost_alt=mig_cost_change+adjust2*mig_cost_change*(mig_change-target_mig)/(mig_change+target_mig);
mig_cost_change=mig_cost_alt;

end

%Tables in paper

%Table 2: Change in the location of economic activity

%Panel A: Total production by country and industry.

panel_A=([variables(38,1) variables(39,1) variables(109,1) variables(40,1); variables(32,1) variables(33,1) variables(110,1) variables(34,1);...
    variables(29,1) variables(30,1) variables(111,1) variables(31,1); variables(23,1) variables(24,1) variables(112,1) variables(25,1);...
    variables(26,1) variables(27,1) variables(113,1) variables(28,1); variables(35,1) variables(36,1) variables(114,1) variables(37,1)]-1)*100


%Panel B: Production of MNEs in the US by source-country and industry.

panel_B=([variables(74,1) variables(75,1) variables(121,1); variables(76,1) variables(77,1) variables(122,1);...
    variables(78,1) variables(79,1) variables(123,1); variables(82,1) variables(83,1) variables(125,1);...
    variables(80,1) variables(81,1) variables(124,1)]-1)*100


%Table 3: Change in real wages and compensating variation - Columns 1 - 4
%(Columns 5 and 6 are computed using the "No MNE" and "No Trade" codes respectively)


%High skill wage bill $2,821 billion
%Low skill wage bill $2,936 billion

%10% change on immigrants - 453,821 additional immigrants
format longg
table_3=[(variables(5,1)-1)*100 (variables(94,1)-1)*100 (1/variables(5,1)-1)*2821 1000000000*(1/variables(5,1)-1)*2821/453821; (variables(6,1)-1)*100 (variables(95,1)-1)*100 ...
    (1/variables(6,1)-1)*2936 1000000000*(1/variables(6,1)-1)*2936/453821;...
    (variables(7,1)-1)*100 (variables(96,1)-1)*100 (1/variables(5,1)-1)*2821+(1/variables(6,1)-1)*2936 1000000000*((1/variables(5,1)-1)*2821+(1/variables(6,1)-1)*2936)/453821]

%Table F16: Contribution of MNEs to output drop

%Bottom panel: Share in total production by MNE source
mne_shares_table=[MNE_shares_IT_us' MNE_shares_Man_us' MNE_shares_Fin_us']

%Top panel: Decomposition of change in revenues by MNE origin
decomposition_table=[((variables(74,1)-1)*mne_shares_table(1,1))*100 ((variables(75,1)-1)*mne_shares_table(1,2))*100 ((variables(121,1)-1)*mne_shares_table(1,3))*100;...
    diag(panel_B(2:5,:)'*mne_shares_table(2:5,:))']


%Table F17: Understanding mechanisms - elasticities

%Change lambda=7 in line 26 and re-run code to get column 2
%Change lambda=2 in line 26 and re-run code to get column 3
%Change epsilon=3 in line 27 and re-run code to get column 4
%Change kappa=2 in line 30 and re-run code to get column 5
%Change kappa=8.28 in line 30 and re-run code to get column 6

%Welfare column 
welfare_result=[(variables(5,1)-1)*100 (variables(6,1)-1)*100 (variables(7,1)-1)*100]





%Table F19: Employment response to a change in immigrants across origin countries


%To replicate this table follow the steps below:

%1) Adapt the migration cost to only change for one specific origin 

%2) Adjust the loop variable omega_crit2=abs(mig_change-target_mig) to have
%mig_change only compute the change of the relevant origin

%3) Store results below for employment_mnes_us

%4) Repeat the process for all 4 countries with MNEs in US 

mne_shares_within_s=[0.815632609	0.125094451	0.059272941...
0.15312413	0.592571752	0.254304117...
0.074238629	0.369493024	0.556268347...
0.021409456	0.711150758	0.267439786];

mne_shares_within_us=[0.494551756	0.269922381	0.235525864];


employment_in_in_us=employment_us_IT_in*mne_shares_within_s(1,1)+employment_us_Man_in*mne_shares_within_s(1,2)+employment_us_Fin_in*mne_shares_within_s(1,3);
employment_eu_in_us=employment_us_IT_eu*mne_shares_within_s(1,4)+employment_us_Man_eu*mne_shares_within_s(1,5)+employment_us_Fin_eu*mne_shares_within_s(1,6);
employment_ca_in_us=employment_us_IT_ca*mne_shares_within_s(1,7)+employment_us_Man_ca*mne_shares_within_s(1,8)+employment_us_Fin_ca*mne_shares_within_s(1,9);
employment_ch_in_us=employment_us_IT_ch*mne_shares_within_s(1,10)+employment_us_Man_ch*mne_shares_within_s(1,11)+employment_us_Fin_ch*mne_shares_within_s(1,12);
employment_us_in_us=employment_us_IT_us*mne_shares_within_us(1,1)+employment_us_Man_us*mne_shares_within_us(1,2)+employment_us_Fin_us*mne_shares_within_us(1,3);

employment_mnes_us=[employment_in_in_us employment_eu_in_us employment_ca_in_us employment_ch_in_us employment_us_in_us];


toc